You are here

function views_plugin_style_lineage_nested::nested_list in Taxonomy Lineage 7

Same name and namespace in other branches
  1. 6 views_plugin_style_lineage_nested.inc \views_plugin_style_lineage_nested::nested_list()
1 call to views_plugin_style_lineage_nested::nested_list()
views_plugin_style_lineage_nested::render in plugins/views_plugin_style_lineage_nested.inc
Render the display in this style.

File

plugins/views_plugin_style_lineage_nested.inc, line 238
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 nested_list($rows, $header, $type, $depth = 1) {
  $output = "";
  if (!empty($header)) {
    $output .= $this
      ->header($header, $depth);
    $depth++;
  }
  $output .= "<{$type}>\n";
  foreach ($rows as $key => $row) {
    $output .= "<li>\n";

    // @todo Add classes.
    // If the next child is an array of rows, recurse.
    if (is_array($row) || is_object($row)) {

      // @todo Allow type to vary per list? (And how would we store that?)
      $output .= $this
        ->nested_list($row, $key, $type, $depth);
    }
    else {
      $output .= $row;
    }
    $output .= "</li>\n";
  }
  $output .= "</{$type}>\n";
  return $output;
}