function MediaLibraryThemeHooks::preprocessViewsViewFields
Implements hook_preprocess_views_view_fields().
Attributes
#[Hook('preprocess_views_view_fields')]
File
-
core/
modules/ media_library/ src/ Hook/ MediaLibraryThemeHooks.php, line 37
Class
- MediaLibraryThemeHooks
- Hook implementations for media_library.
Namespace
Drupal\media_library\HookCode
public function preprocessViewsViewFields(&$variables) : void {
// Add classes to media rendered entity field so it can be targeted for
// JavaScript mouseover and click events.
if ($variables['view']->id() === 'media_library' && isset($variables['fields']['rendered_entity'])) {
if (isset($variables['fields']['rendered_entity']->wrapper_attributes)) {
$variables['fields']['rendered_entity']->wrapper_attributes
->addClass('js-click-to-select-trigger');
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.