You are here

function _location_taxonomize_get_hierarchy in Location Taxonomize 7.2

Same name and namespace in other branches
  1. 7 location_taxonomize.inc \_location_taxonomize_get_hierarchy()

Returns the hierarchy configured for the current Location Vocabulary

Parameters

$assoc - whether to return an associative array (TRUE) or: keyed array (FALSE)

$labels - if TRUE and $assoc is TRUE, returns the labels: of the fields as the array values

4 calls to _location_taxonomize_get_hierarchy()
location_taxonomize_form in ./location_taxonomize.admin.inc
Location Taxonomize administration form
location_taxonomize_make_longname in ./location_taxonomize.module
location_taxonomize_process_item in ./location_taxonomize.module
Determines if a location needs to be taxonomized. If so, it saves the appropriate terms Returns an array containing two items: the first is the number of new terms saved, and the second is an array of all the terms that correspond to this object,…
_location_taxonomize_init_var_longname in ./location_taxonomize.inc
Initializes the Long Name fields variable (called during initialization)

File

./location_taxonomize.inc, line 83
Some useful functions for Location taxonomize

Code

function _location_taxonomize_get_hierarchy($assoc = FALSE, $labels = FALSE) {
  $settings = variable_get('location_taxonomize_vocab');
  $fields = $settings['hierarchy'];
  if ($labels) {
    $withlabels = _location_taxonomize_get_fields(TRUE, TRUE);
  }
  $hierarchy = array();
  foreach ($fields as $key => $value) {
    if ($value) {
      if ($assoc) {
        if ($labels) {
          $hierarchy[$key] = $withlabels[$key];
        }
        else {
          $hierarchy[$key] = $key;
        }
      }
      else {
        $hierarchy[] = $key;
      }
    }
  }
  return $hierarchy;
}