Last active
          December 16, 2015 08:49 
        
      - 
      
- 
        Save davereid/5408617 to your computer and use it in GitHub Desktop. 
    Removing instance settings on uninstall
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | <?php | |
| /** | |
| * Implements hook_uninstall(). | |
| */ | |
| function mymodule_uninstall() { | |
| $fields = field_read_fields(array('module' => 'mymodule')); | |
| $instances = field_read_instances(array('field_name' => array_keys($fields))); | |
| foreach ($instances as $instance) { | |
| if (isset($instance['settings']['my_added_setting'])) { | |
| unset($instance['settings']['my_added_setting']); | |
| field_update_instance($instance); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment