You are here

function media_library_preprocess_views_view_fields in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/media_library.module \media_library_preprocess_views_view_fields()

Implements hook_preprocess_views_view_fields().

File

core/modules/media_library/media_library.module, line 257
Contains hook implementations for the media_library module.

Code

function media_library_preprocess_views_view_fields(&$variables) {

  // 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');
    }
  }
}