function claro_preprocess_views_view_fields__media_library

Same name and namespace in other branches
  1. 8.9.x core/themes/claro/claro.theme \claro_preprocess_views_view_fields__media_library()
  2. 10 core/themes/claro/claro.theme \claro_preprocess_views_view_fields__media_library()
  3. 11.x core/themes/claro/claro.theme \claro_preprocess_views_view_fields__media_library()

Implements hook_preprocess_views_view_fields().

This targets each rendered media item in the grid display of the media library's modal dialog.

File

core/themes/claro/claro.theme, line 1327

Code

function claro_preprocess_views_view_fields__media_library(array &$variables) {
    // 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.