You are here

function getlocations_search_term_get in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_search/getlocations_search.module \getlocations_search_term_get()

Return value

array $matches Returns a list of terms of a given vocabulary, suitable for a dropdown

1 call to getlocations_search_term_get()
getlocations_search_form in modules/getlocations_search/getlocations_search.module
The search form

File

modules/getlocations_search/getlocations_search.module, line 1254
getlocations_search.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_search_term_get() {
  $matches = array();

  // Taxonomy which holds locative info
  $getlocations_search_defaults = getlocations_search_defaults();
  $vid = FALSE;
  if (is_numeric($getlocations_search_defaults['vocab']) && $getlocations_search_defaults['vocab'] > 0) {
    $vid = $getlocations_search_defaults['vocab'];
  }
  if ($vid) {
    $query = db_select('taxonomy_term_data', 't');
    $query
      ->fields('t', array(
      'name',
    ))
      ->condition('t.vid', $vid, '=');
    $result = $query
      ->execute();
    foreach ($result as $row) {
      $matches[$row->name] = getlocations_apoclean($row->name);
    }
  }
  ksort($matches);
  return $matches;
}