function views_pdf_plugin_style_unformatted::render_grouping_sets in Views PDF 7
Same name and namespace in other branches
- 7.2 plugins/views_pdf_plugin_style_unformatted.inc \views_pdf_plugin_style_unformatted::render_grouping_sets()
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.
Overrides views_plugin_style::render_grouping_sets
File
- ./
views_pdf_plugin_style_unformatted.inc, line 28 - Unformatted PDF style
Class
- views_pdf_plugin_style_unformatted
- This class holds all the funtionality used for the unformatted style plugin.
Code
function render_grouping_sets($sets, $level = 0) {
$output = '';
$next_level = $level + 1;
foreach ($sets as $set) {
$row = reset($set['rows']);
// Render as a grouping set.
if (is_array($row) && isset($row['group'])) {
$field_id = $this->options['grouping'][$level]['field'];
$options = array();
if (isset($this->row_plugin->options['formats'][$field_id])) {
$options = $this->row_plugin->options['formats'][$field_id];
}
$this->view->pdf
->drawContent($set['group'], $options, $this->view);
$this
->render_grouping_sets($set['rows'], $next_level);
}
else {
if (!empty($set['group'])) {
$field_id = $this->options['grouping'][$level]['field'];
$options = array();
if (isset($this->row_plugin->options['formats'][$field_id])) {
$options = $this->row_plugin->options['formats'][$field_id];
}
$this->view->pdf
->drawContent($set['group'], $options, $this->view);
}
if ($this
->uses_row_plugin()) {
foreach ($set['rows'] as $index => $row) {
$this->view->row_index = $index;
$set['rows'][$index] = $this->row_plugin
->render($row);
}
}
}
}
unset($this->view->row_index);
return $output;
}