function ViewsViewsHooks::viewsDataAlter
Implements hook_views_data_alter().
Field modules can implement hook_field_views_data_views_data_alter() to alter the views data on a per field basis. This is weirdly named so as not to conflict with the \Drupal::moduleHandler()->alter('field_views_data') in views_views_data().
File
-
core/
modules/ views/ src/ Hook/ ViewsViewsHooks.php, line 197
Class
- ViewsViewsHooks
- Hook implementations for views.
Namespace
Drupal\views\HookCode
public function viewsDataAlter(&$data) {
$entity_type_manager = \Drupal::entityTypeManager();
if (!$entity_type_manager->hasDefinition('field_storage_config')) {
return;
}
/** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
foreach ($entity_type_manager->getStorage('field_storage_config')
->loadMultiple() as $field_storage) {
if (_views_field_get_entity_type_storage($field_storage)) {
\Drupal::moduleHandler()->invoke($field_storage->getTypeProvider(), 'field_views_data_views_data_alter', [
&$data,
$field_storage,
]);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.