You are here

function _taxonomy_manager_tree_get_selected_terms in Taxonomy Manager 6

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \_taxonomy_manager_tree_get_selected_terms()
  2. 6.2 taxonomy_manager.module \_taxonomy_manager_tree_get_selected_terms()
  3. 7 taxonomy_manager.module \_taxonomy_manager_tree_get_selected_terms()

returns term ids of selected checkboxes

goes through nested form array recursivly

Parameters

$form_values:

Return value

an array with ids of selected terms

1 call to _taxonomy_manager_tree_get_selected_terms()
taxonomy_manager_tree_validate in ./taxonomy_manager.module
validates submitted form values checks if selected terms really belong to initial voc, if not --> form_set_error

File

./taxonomy_manager.module, line 801
Taxonomy Manager

Code

function _taxonomy_manager_tree_get_selected_terms($form_values) {
  $tids = array();
  if (is_array($form_values)) {
    foreach ($form_values as $tid => $form_value) {
      if ($form_value['checkbox'] && $tid && $tid == $form_value['checkbox']) {
        $tids[$tid] = $tid;
      }
      if (is_array($form_value['children'])) {
        $tids += _taxonomy_manager_tree_get_selected_terms($form_value['children']);
      }
    }
  }
  return $tids;
}