function _taxonomy_manager_tree_term_set_class in Taxonomy Manager 7
calculates class type (expandable, lastExpandable) for current element
Parameters
$current_index in tree array:
$tree array with terms:
1 call to _taxonomy_manager_tree_term_set_class()
- taxonomy_manager_tree_build_form in ./
taxonomy_manager.module - recursive function for building nested form array with checkboxes and weight forms for each term
File
- ./
taxonomy_manager.module, line 674 - Taxonomy Manager
Code
function _taxonomy_manager_tree_term_set_class(&$class, $current_index, $tree, $expand) {
$term = $tree[$current_index];
$next_index = ++$current_index;
$next = isset($tree[$next_index]) ? $tree[$next_index] : NULL;
$children = FALSE;
if (!empty($next) && $next->depth > $term->depth) {
$children = TRUE;
}
if ($children) {
if (!empty($next->depth) && $next->depth == $term->depth) {
$class[] = $expand ? 'collapsable' : 'expandable';
}
else {
$class[] = $expand ? 'lastCollapsable' : 'lastExpandable';
}
}
elseif (_taxonomy_manager_tree_term_children_count($term->tid) > 0) {
$class[] = 'has-children';
if ($current_index == count($tree)) {
$class[] = 'lastExpandable';
}
else {
$class[] = 'expandable';
}
}
elseif (count($tree) == $current_index || !empty($next) && $term->depth > $next->depth) {
$class[] = 'last';
}
return $class;
}