function template_preprocess_views_bootstrap_grid in Views Bootstrap 8.4
Same name and namespace in other branches
- 8.3 views_bootstrap.theme.inc \template_preprocess_views_bootstrap_grid()
Prepares variables for views grid templates.
Default template: views-bootstrap-grid.html.twig.
Parameters
array $vars: An associative array containing:
- view: A ViewExecutable object.
- rows: The raw row data.
1 string reference to 'template_preprocess_views_bootstrap_grid'
- ViewsBootstrap::getThemeHooks in src/
ViewsBootstrap.php - Returns the theme hook definition information.
File
- ./
views_bootstrap.theme.inc, line 132 - Preprocessors and helper functions to make theming easier.
Code
function template_preprocess_views_bootstrap_grid(array &$vars) {
$view = $vars['view'];
$vars['id'] = ViewsBootstrap::getUniqueId($view);
$vars['attributes']['class'][] = 'grid';
$options = $view->style_plugin->options;
$vars['row_attributes'] = new Attribute();
foreach (ViewsBootstrap::getBreakpoints() as $breakpoint) {
if ($options["col_{$breakpoint}"] == 'none') {
continue;
}
$vars['row_attributes']
->addClass($options["col_{$breakpoint}"]);
}
$vars['options'] = $options;
}