Программно получить Domain ID Терминов таксономии Domain Taxanomy (Drupal 7). Programmatically get Domain ID Taxonomy terms Domain Taxonomy

  1. $tid = 227; // WARNING :)
  2. $result = db_query("SELECT gid, realm FROM {domain_taxonomy_access} WHERE tid = :tid AND (realm = 'domain_id' OR realm = 'domain_site')",
  3. array(':tid' => $tid));
  4.  
  5. foreach ($result as $data) {
  6. // Transform the 0 to -1, since {domain_access} is unsigned.
  7. ($data->gid == 0) ? $gid = -1 : $gid = $data->gid;
  8. print $gid;
  9. }