taxonomy_field_views_data_alter

taxonomy_field_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage)

Implements hook_field_views_data_alter().

Views integration for entity reference fields which reference taxonomy terms. Adds a term relationship to the default field data.

See also

views_field_default_views_data()

File

core/modules/taxonomy/taxonomy.views.inc, line 62
Provides views data for taxonomy.module.

Code

function taxonomy_field_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage) {
  if ($field_storage->getType() == 'entity_reference' && $field_storage->getSetting('target_type') == 'taxonomy_term') {
    foreach ($data as $table_name => $table_data) {
      foreach ($table_data as $field_name => $field_data) {
        if (isset($field_data['filter']) && $field_name != 'delta') {
          $data[$table_name][$field_name]['filter']['id'] = 'taxonomy_index_tid';
        }
      }
    }
  }
}
doc_Drupal
2016-10-29 09:46:30
Comments
Leave a Comment

Please login to continue.