function 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';
        }
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!taxonomy!taxonomy.views.inc/function/taxonomy_field_views_data_alter/8.1.x