public function StylePluginBase::renderGroupingSets in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::renderGroupingSets()
Render the grouping sets.
Plugins may override this method if they wish some other way of handling grouping.
Parameters
$sets: Array containing the grouping sets to render.
$level: Integer indicating the hierarchical level of the grouping.
Return value
string Rendered output of given grouping sets.
1 call to StylePluginBase::renderGroupingSets()
- StylePluginBase::render in core/
modules/ views/ src/ Plugin/ views/ style/ StylePluginBase.php - Render the display in this style.
File
- core/
modules/ views/ src/ Plugin/ views/ style/ StylePluginBase.php, line 480 - Contains \Drupal\views\Plugin\views\style\StylePluginBase.
Class
- StylePluginBase
- Base class for views style plugins.
Namespace
Drupal\views\Plugin\views\styleCode
public function renderGroupingSets($sets, $level = 0) {
$output = array();
$theme_functions = $this->view
->buildThemeFunctions($this->groupingTheme);
foreach ($sets as $set) {
$row = reset($set['rows']);
// Render as a grouping set.
if (is_array($row) && isset($row['group'])) {
$output[] = array(
'#theme' => $theme_functions,
'#view' => $this->view,
'#grouping' => $this->options['grouping'][$level],
'#grouping_level' => $level,
'#rows' => $set['rows'],
'#title' => $set['group'],
);
}
else {
if ($this
->usesRowPlugin()) {
foreach ($set['rows'] as $index => $row) {
$this->view->row_index = $index;
$set['rows'][$index] = $this->view->rowPlugin
->render($row);
}
}
$single_output = $this
->renderRowGroup($set['rows']);
$single_output['#grouping_level'] = $level;
$single_output['#title'] = $set['group'];
$output[] = $single_output;
}
}
unset($this->view->row_index);
return $output;
}