You are here

function commons_topics_system_info_alter in Drupal Commons 7.3

Implements hook_system_info_alter().

File

modules/commons/commons_topics/commons_topics.module, line 12

Code

function commons_topics_system_info_alter(&$info, $file, $type) {

  // Commons Topics dynamically adds field_topics to content types that implement
  // commons_topics_field. We must add a corresponding line for each field
  // instance to commons_topics.info so that Features is aware of the instance
  // and can sucessfully revert the field_instance component back to its
  // default state.
  if ($file->name == 'commons_topics') {
    $commons_topics_entity_types = commons_topics_get_entity_types_with_topics();
    if (!empty($commons_topics_entity_types)) {
      foreach ($commons_topics_entity_types as $entity_type => $bundles) {
        foreach (array_keys($bundles) as $bundle) {
          $info['features']['field_instance'][] = "{$entity_type}-{$bundle}-field_topics";
        }
      }
    }
  }
}