function _taxonomy_manager_tree_term_get_class in Taxonomy Manager 6.2
Same name and namespace in other branches
- 5 taxonomy_manager.module \_taxonomy_manager_tree_term_get_class()
- 6 taxonomy_manager.module \_taxonomy_manager_tree_term_get_class()
calculates class type (expandable, lastExpandable) for current element
Parameters
$current_index in tree array:
$tree array with terms:
Return value
expandable or lastExpandable
1 call to _taxonomy_manager_tree_term_get_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 705 - Taxonomy Manager
Code
function _taxonomy_manager_tree_term_get_class($current_index, $tree, $expand) {
$term = $tree[$current_index];
$next = $tree[++$current_index];
$children = FALSE;
while ($next->depth > $term->depth) {
$children = TRUE;
$next = $tree[++$current_index];
}
if ($children) {
if (isset($next->depth) && $next->depth == $term->depth) {
$class .= $expand ? 'collapsable' : 'expandable';
}
else {
$class .= $expand ? 'lastCollapsable' : 'lastExpandable';
}
}
else {
if (_taxonomy_manager_tree_term_children_count($term->tid) > 0) {
$class .= 'has-children ';
if ($current_index == count($tree)) {
$class .= 'lastExpandable';
}
else {
$class .= 'expandable';
}
}
else {
if (count($tree) == $current_index || $term->depth > $next->depth) {
$class = 'last';
}
}
}
return $class;
}