You are here

function masonry_views_preprocess_views_view in Masonry Views 8

Implements hook_preprocess_views_view().

File

./masonry_views.module, line 59
Provides a Views plugin for displaying content in a Masonry layout.

Code

function masonry_views_preprocess_views_view(&$variables) {
  $view = $variables['view'];
  $style = $view->style_plugin;
  if ($style
    ->getPluginId() === 'masonry' && !empty($variables['rows'])) {
    $variables['rows']['#theme_wrappers']['container']['#attributes']['data-drupal-masonry-layout'] = TRUE;
    $variables['rows']['#theme_wrappers']['container']['#attributes']['class'][] = 'masonry-layout-' . Html::cleanCssIdentifier($view->storage
      ->id());
  }
}