You are here

function template_preprocess_uikit_view_grid in UIkit Components 7.3

Same name and namespace in other branches
  1. 8.3 uikit_views/includes/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
  2. 8 uikit_views/includes/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
  3. 8.2 uikit_views/includes/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
  4. 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.tpl.php.

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'
uikit_views_theme in uikit_views/uikit_views.module
Implements hook_theme().

File

uikit_views/templates/uikit_views.theme.inc, line 79
Preprocessors and helper functions to make theming easier.

Code

function template_preprocess_uikit_view_grid(&$variables) {
  $view = $variables['view'];
  $options = $view->style_plugin->options;
  $grid_classes = array(
    'uk-grid',
  );
  $attributes = array(
    'class' => array(
      'uikit-view-grid',
    ),
  );
  $variables['grid_divider'] = FALSE;
  if ($options['grid_divider']) {
    $grid_classes[] = 'uk-grid-divider';
  }
  if ($options['grid_gutter'] != 'default') {
    $grid_classes[] = $options['grid_gutter'];
  }
  foreach ([
    '@s',
    '@m',
    '@l',
    '@xl',
  ] as $size) {
    $grid_classes[] = $options["width_{$size}"];
  }
  if ($options['row_class']) {
    $grid_classes[] = $options['row_class'];
  }
  $variables['attributes_array'] = $attributes;
  $variables['grid_classes'] = implode(' ', $grid_classes);
  drupal_add_css(drupal_get_path('module', 'uikit_views') . '/css/uikit-views.grid.layout.css');
}