You are here

function theme_nodehierarchy_node_list in Node Hierarchy 6

Same name and namespace in other branches
  1. 5 nodehierarchy_theme.inc \theme_nodehierarchy_node_list()

Display a list of nodes with nodehierarchy actions

File

./nodehierarchy_theme.inc, line 37
Nodehierarchy theming functions

Code

function theme_nodehierarchy_node_list($nodes, $expandable = FALSE) {
  $out = "";
  $rows = array();
  foreach ($nodes as $node) {
    if (node_access('view', $node)) {
      $row = array(
        "class" => "nodehierarchy_child",
        "id" => 'nh-' . $node->nid,
        'data' => theme("nodehierarchy_actions", $node),
      );
      if ($expandable) {
        $row['data'] .= _nodehierarchy_toggle_expand_link($node->title, $node->nid);
      }
      else {
        $row['data'] .= l($node->title, "node/" . $node->nid);
      }
      if ($expandable && _nodehierarhcy_is_expanded($node->nid)) {
        $row['data'] .= _nodehierarchy_display_children_list($node, TRUE);
        $row['class'] .= " expanded";
      }
      elseif ($expandable && variable_get('nh_parent_' . $node->type, FALSE)) {
        $row['class'] .= " collapsed";
      }
      $rows[] = $row;
    }
  }
  if ($rows) {
    $out .= theme("node_hierarchy_item_list", $rows, array(
      "class" => "nodehierarchy_outline menu",
    ));
  }
  return $out;
}