You are here

function uikit_views_views_preview_info_alter in UIkit Components 8

Same name and namespace in other branches
  1. 8.3 uikit_views/uikit_views.module \uikit_views_views_preview_info_alter()
  2. 8.2 uikit_views/uikit_views.module \uikit_views_views_preview_info_alter()

Implements hook_views_preview_info_alter().

File

uikit_views/uikit_views.module, line 77
UIkit Views.

Code

function uikit_views_views_preview_info_alter(array &$rows, ViewExecutable $view) {
  $style = $view
    ->getStyle();
  $plugin_id = $style
    ->getPluginId();

  // UIkit Components views plugin styles.
  $uikit_plugins = [
    'uikit_view_grid',
    'uikit_view_list',
    'uikit_view_table',
  ];
  if (in_array($plugin_id, $uikit_plugins)) {

    // Attach the UIkit library so views previews are styled correctly.
    $view->element['#attached']['library'][] = "uikit_views/uikit";
  }
}