You are here

function lightning_media_preprocess_views_view_grid in Lightning Media 8

Same name and namespace in other branches
  1. 8.4 lightning_media.module \lightning_media_preprocess_views_view_grid()
  2. 8.2 lightning_media.module \lightning_media_preprocess_views_view_grid()
  3. 8.3 lightning_media.module \lightning_media_preprocess_views_view_grid()

Preprocess function for grid views of the media library.

Parameters

array $variables: Template variables.

File

./lightning_media.module, line 512
Core media asset support for Lightning.

Code

function lightning_media_preprocess_views_view_grid(array &$variables) {

  /** @var \Drupal\views\ViewExecutable $view */
  $view = $variables['view'];
  if ($view->display_handler
    ->getPluginId() == 'entity_browser') {
    foreach ($variables['items'] as &$item) {
      foreach ($item['content'] as &$column) {
        $column['attributes']['data-selectable'] = 'true';
      }
    }
  }
}