You are here

function _taxonomy_manager_tree_get_selected_terms in Taxonomy Manager 5

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.module \_taxonomy_manager_tree_get_selected_terms()
  2. 6 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

2 calls to _taxonomy_manager_tree_get_selected_terms()
taxonomy_manager_terms_confirm_delete in ./taxonomy_manager.module
Additional confirmation form for deletion
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 2017
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']) {
        $tids[$tid] = $tid;
      }
      if (is_array($form_value['children'])) {
        $tids += _taxonomy_manager_tree_get_selected_terms($form_value['children']);
      }
    }
  }
  return $tids;
}