Last active
March 14, 2016 14:59
-
-
Save batigolix/22ad36fe86d32e159fac to your computer and use it in GitHub Desktop.
delete-drupal-fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Deletes obsolete fields. | |
*/ | |
function generic_project_update_7000() { | |
$fields = array( | |
'field_gp_country', | |
'field_gp_description', | |
'field_gp_location', | |
'field_gp_project_manager', | |
'gp_project_manager', | |
'field_gp_tags', | |
'nuts_regions', | |
'field_nuts_regions', | |
'field_abbreviation', | |
'field_adrress', | |
'field_address', | |
'field_budget', | |
'field_date', | |
'field_links', | |
'field_location', | |
'gp_adrress', | |
); | |
foreach ($fields as $field) { | |
if ($instance = field_info_instance('node', $field, 'generic_project')) { | |
field_delete_instance($instance); | |
} | |
} | |
field_purge_batch(count($fields)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment