function template_preprocess_uikit_view_grid in UIkit Components 8
Same name and namespace in other branches
- 8.3 uikit_views/includes/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
 - 8.2 uikit_views/includes/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
 - 7.3 uikit_views/templates/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
 - 7.2 uikit_views/templates/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
 
Prepares variables for UIkit Grid templates.
Default template: uikit-view-grid.html.twig.
Parameters
array $variables: An associative array containing:
- view: A ViewExecutable object.
 - rows: The raw row data.
 
1 string reference to 'template_preprocess_uikit_view_grid'
- UIkitViews::getThemeHooks in uikit_views/
src/ UIkitViews.php  - Returns the theme hook definition information for UIkit Views.
 
File
- uikit_views/
includes/ uikit_views.theme.inc, line 22  - Preprocessors and helper functions to make theming easier.
 
Code
function template_preprocess_uikit_view_grid(array &$variables) {
  $view = $variables['view'];
  $options = $view->style_plugin->options;
  $grid_classes = [
    'uk-grid',
  ];
  $variables['grid_divider'] = FALSE;
  if ($options['grid_divider']) {
    $variables['grid_divider'] = TRUE;
  }
  if ($options['grid_gutter'] != 'default') {
    $grid_classes[] = $options['grid_gutter'];
  }
  foreach ([
    'small',
    'medium',
    'large',
    'xlarge',
  ] as $size) {
    $grid_classes[] = $options["width_" . $size];
  }
  if ($options['row_class']) {
    $grid_classes[] = $options['row_class'];
  }
  $variables['grid_classes'] = implode(' ', $grid_classes);
  $variables['id'] = UIkitViews::getUniqueId($view);
  $variables['options'] = $options;
  $variables['uikit_version'] = UIkitComponents::getUIkitLibraryVersion();
}