You are here

function fieldblock_uninstall in Field as Block 7

Implements hook_uninstall().

File

./fieldblock.install, line 6

Code

function fieldblock_uninstall() {

  // Delete variables.
  $entities = entity_get_info();

  // Loop over the entity types.
  foreach ($entities as $entity_type => $entity_info) {

    // Loop over each entity type's bundles.
    foreach ($entity_info['bundles'] as $bundle => $bundle_info) {
      $view_modes = field_view_mode_settings($entity_type, $bundle);

      // Treat the default settings as a real view mode with custom settings.
      $view_modes['default']['custom_settings'] = true;

      // Loop over the bundle's view modes.
      foreach ($view_modes as $view_mode => $view_mode_info) {

        // Delete the variable, if it exists.
        $variable_name = 'fieldblock-' . $entity_type . '-' . $bundle . '-' . $view_mode;
        variable_del($variable_name);
      }
    }
  }
}