function template_preprocess_views_bootstrap_list_group in Views Bootstrap 8.3
Same name and namespace in other branches
- 8.4 views_bootstrap.theme.inc \template_preprocess_views_bootstrap_list_group()
Prepares variables for views list group templates.
Default template: views-bootstrap-list-group.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_list_group'
- ViewsBootstrap::getThemeHooks in src/
ViewsBootstrap.php - Returns the theme hook definition information.
File
- ./
views_bootstrap.theme.inc, line 216 - Preprocessors and helper functions to make theming easier.
Code
function template_preprocess_views_bootstrap_list_group(array &$vars) {
$view = $vars['view'];
$options = $view->style_plugin->options;
$vars['id'] = ViewsBootstrap::getUniqueId($view);
$vars['attributes']['class'][] = 'views-bootstrap-list-group';
$group_title_field = isset($view->style_plugin->options['grouping'][0]) ? $view->style_plugin->options['grouping'][0]['field'] : "";
$vars['panels'] = isset($view->style_plugin->options['panels']) ? $view->style_plugin->options['panels'] : FALSE;
foreach ($vars['rows'] as $id => $row) {
$vars['group_title'] = $group_title_field ? $view->style_plugin
->getField($id, $group_title_field) : "";
$vars['rows'][$id] = [];
$vars['rows'][$id]['content'] = $row;
$vars['rows'][$id]['title'] = $vars['view']->style_plugin
->getField($id, $options['title_field']);
}
}