function PreprocessHooks::viewsViewFieldsMediaLibrary
Same name and namespace in other branches
- 11.x core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::viewsViewFieldsMediaLibrary()
Implements hook_preprocess_views_view_fields().
This targets each rendered media item in the grid display of the media library's modal dialog.
Attributes
#[Hook('preprocess_views_view_fields__media_library')]
File
-
core/
themes/ admin/ src/ Hook/ PreprocessHooks.php, line 1410
Class
- PreprocessHooks
- Provides preprocess implementations.
Namespace
Drupal\admin\HookCode
public function viewsViewFieldsMediaLibrary(array &$variables) : void {
// Add classes to media rendered entity field so it can be targeted for
// styling. Adding this class in a template is very difficult to do.
if (isset($variables['fields']['rendered_entity']->wrapper_attributes)) {
$variables['fields']['rendered_entity']->wrapper_attributes
->addClass('media-library-item__click-to-select-trigger');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.