function template_preprocess_uikit_view_grid in UIkit Components 7.2
Same name and namespace in other branches
- 8.3 uikit_views/includes/uikit_views.theme.inc \template_preprocess_uikit_view_grid()
- 8 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()
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 88 - 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 = [
'uk-grid',
];
$attributes = array(
'class' => array(
'uikit-view-grid',
),
);
$variables['grid_divider'] = FALSE;
if ($options['grid_divider']) {
$attributes['class'][] = 'uikit-view-grid-divider';
}
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['attributes_array'] = $attributes;
$variables['grid_classes'] = implode(' ', $grid_classes);
drupal_add_css(drupal_get_path('module', 'uikit_views') . '/css/uikit-views.grid.layout.css');
}