function template_preprocess_views_view_unformatted

template_preprocess_views_view_unformatted(&$variables)

Prepares variables for views unformatted rows templates.

Default template: views-view-unformatted.html.twig.

Parameters

array $variables: An associative array containing:

  • view: The view object.
  • rows: An array of row items. Each row is an array of content.

File

core/modules/views/views.theme.inc, line 776
Preprocessors and helper functions to make theming easier.

Code

function template_preprocess_views_view_unformatted(&$variables) {
  $view = $variables['view'];
  $rows = $variables['rows'];
  $style = $view->style_plugin;
  $options = $style->options;

  $variables['default_row_class'] = !empty($options['default_row_class']);
  foreach ($rows as $id => $row) {
    $variables['rows'][$id] = array();
    $variables['rows'][$id]['content'] = $row;
    $variables['rows'][$id]['attributes'] = new Attribute();
    if ($row_class = $view->style_plugin->getRowClass($id)) {
      $variables['rows'][$id]['attributes']->addClass($row_class);
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!views!views.theme.inc/function/template_preprocess_views_view_unformatted/8.1.x