You are here

function nodeorder_get_tids in Node Order 6

1 call to nodeorder_get_tids()
nodeorder_orderable_tids in ./nodeorder.module
Returns an array of the node's tids that are in orderable vocabularies...

File

./nodeorder.module, line 607
Nodeorder module.

Code

function nodeorder_get_tids($key, $value) {
  $tids = array();
  if (isset($value)) {
    if ($key === "tags") {
      foreach ($value as $vid => $names) {
        $tids = array_merge($tids, nodeorder_get_tids($vid, $names));
      }
    }
    else {
      if (is_numeric($value)) {
        $tids[] = $value;
      }
      else {
        if (is_array($value)) {
          foreach ($value as $tid) {
            $tids[] = $tid;
          }
        }
        else {
          if (is_string($value)) {
            $values = drupal_explode_tags($value);
            $get_tid_sql = "SELECT tid FROM {term_data} WHERE name = '%s' AND vid = %d";
            foreach ($values as $term_name) {
              $tids[] = db_result(db_query($get_tid_sql, $term_name, $key));
            }
          }
        }
      }
    }
  }
  return $tids;
}