You are here

function template_preprocess_views_bootstrap_list_group in Views Bootstrap 8.4

Same name and namespace in other branches
  1. 8.3 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 159
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';
  foreach ($vars['rows'] as $id => $row) {
    $vars['rows'][$id] = [];
    $vars['rows'][$id]['content'] = $row;
    $vars['rows'][$id]['title'] = $vars['view']->style_plugin
      ->getField($id, $options['title_field']);
  }
}