function views_plugin_style_lineage_nested::render in Taxonomy Lineage 6
Same name and namespace in other branches
- 7 plugins/views_plugin_style_lineage_nested.inc \views_plugin_style_lineage_nested::render()
File
- ./views_plugin_style_lineage_nested.inc, line 113
- Views style plugin that allows a view to be rendered as a nested list,
based on Lineage's term hierarchy.
Class
- views_plugin_style_lineage_nested
- Implements views_plugin_style.
Code
function render() {
if ($this
->uses_row_plugin() && empty($this->row_plugin)) {
vpr('views_plugin_style_default: Missing row plugin');
return;
}
$output = '';
$sets = $this
->render_grouping($this->view->result, $this->options['grouping']);
foreach ($sets as $title => $records) {
if ($this
->uses_row_plugin()) {
$rendered = array();
foreach ($records as $row_index => $row) {
$this->view->row_index = $row_index;
$rendered[$row_index] = $this->row_plugin
->render($row);
}
}
$term_name = FALSE;
if ($this->options['filter']) {
if ($arg_name = strstr($this->options['filter'], "a_")) {
$arg_name = substr($arg_name, 2);
$arg = $this->display->handler->handlers['argument'][$arg_name];
$term = $arg->argument;
}
elseif ($filter_name = strstr($this->options['filter'], "f_")) {
$filter_name = substr($filter_name, 2);
$filter = $this->display->handler->handlers['filter'][$filter_name];
$terms = $filter->value;
$term = array_pop($terms);
}
if (is_numeric($term)) {
$term_obj = taxonomy_get_term($term);
$term_name = $term_obj->name;
}
else {
$term_name = $term;
}
}
$nested_set = $this
->render_nesting($records, $rendered, $this->options['nesting'], $term_name);
if ($this->options['start_depth']) {
$depth = $this->options['start_depth'];
}
else {
$depth = LINEAGE_START_DEPTH;
}
$output .= $this
->nested_list($nested_set, $title, $this->options['type'], $depth);
}
unset($this->view->row_index);
return $output;
}