You are here

function _tss_next_nested in Taxonomy Super Select (TSS) 5

Same name and namespace in other branches
  1. 6 taxonomy_super_select.module \_tss_next_nested()

Recursive function to allow infinite depth vocabularies.

Parameters

array &$terms The result of taxonomy_get_tree for the vocabulary's $vid.:

array &$vid The vocabulary to work on. Passed by reference just to keep overhead: of copies down.

array &$input The portion of the vocabulary to look at (parent_type?). Passed by: reference just to keep overhead of copies down.

array $tss These are the settings for this module.:

array &$form_node This is a subsection of $form, namely $form['#node'] should be: passed in.

array &$form_branch This is a subsection of $form. Each iteration adds to the one: before, then passes itself as the new branch. _tss_branch() is called for each iteration and appended to it.

Return value

since values are passed in via reference, no return value is required.

1 call to _tss_next_nested()
taxonomy_super_select_form_alter in ./taxonomy_super_select.module
@file Changes the default taxonomy select box into checkbox or radio buttons.

File

./taxonomy_super_select.module, line 147
Changes the default taxonomy select box into checkbox or radio buttons.

Code

function _tss_next_nested(&$terms, &$vid, &$input, $tss, &$form_node, &$form_branch) {
  $fieldweight = 0;
  foreach ($terms as $index => $term) {
    $child = taxonomy_get_children($term->tid, $vid);
    if (count($child)) {
      if ($tss[$vid]['parents']) {
        $term->is_parent = TRUE;
        $term->parent_type = $input;
        $term->parent_value = $form_node->taxonomy[$term->tid]->tid;
      }
      $form_branch[$term->tid] = _tss_branch($vid, $term, NULL, 'fieldset', ++$fieldweight);
      _tss_next_nested($child, $vid, $input, $tss, $form_node, $form_branch[$term->tid]);
    }
    else {
      if ($value = $form_node->taxonomy[$term->tid]->tid) {
        $form_branch['#collapsed'] = FALSE;
      }
      $form_branch[$term->tid] = _tss_branch($vid, $term, $value, $input, $fieldweight++);
    }
  }
}