You are here

function theme_nodehierarchy_children_list in Node Hierarchy 5

Same name and namespace in other branches
  1. 6 nodehierarchy_theme.inc \theme_nodehierarchy_children_list()

Return a themed list of items.

2 theme calls to theme_nodehierarchy_children_list()
nodehierarchy_callback_ajax in ./nodehierarchy.module
Ajax callback.
_nodehierarchy_display_children_list in ./nodehierarchy.module
Get the children list of the given node.

File

./nodehierarchy_theme.inc, line 142
Nodehierarchy theming functions.

Code

function theme_nodehierarchy_children_list($node, $children, $show_create_links = TRUE) {
  $output = "";
  if (!empty($children)) {
    $output .= '<ul class="nodehierarchy_outline menu">';
    $i = 1;
    foreach ($children as $nid => $item) {
      $children_list = "";
      $attributs = array();
      $title = check_plain($item['node']->title);
      if ($item['url']) {
        $title = '<a href="' . $item['url'] . '" class="' . ($item['expandable'] ? "expand_widget" : "non_expandable") . ($item['expanded'] ? " expanded" : " collapsed") . '" title="' . $item['tooltip'] . '">' . $title . '</a>';
      }
      $attributes['id'] = "nodehierarchy_child-" . $item['node']->nid;
      $attributes['class'] = "nodehierarchy_child";
      if ($item['expandable']) {
        $attributes['class'] .= " expandable";
        $attributes['class'] .= $item['expanded'] ? " expanded" : " collapsed";
      }
      if (!nodehierarchy_previous_sibling_nid($item['node'])) {
        $attributes['class'] .= " first";
      }
      if (!nodehierarchy_next_sibling_nid($item['node'])) {
        $attributes['class'] .= " last";
      }
      $actions = theme("nodehierarchy_actions", $item['node']);
      $grandchildren = "";
      if ($item['expanded']) {
        $grandchildren = theme("nodehierarchy_children_list", $item['node'], $item['children']);
      }
      $output .= '<li' . drupal_attributes($attributes) . '><div class="item">' . $actions . $title . '</div><div class="children">' . $grandchildren . '</div></li>';
      $i++;
    }
    $output .= "</ul>";
  }
  else {
    $output .= t("This node has no children");
  }
  if ($show_create_links) {
    $output .= theme("nodehierarchy_new_child_links", $node);
  }
  return $output;
}