You are here

function og_vocab_query_taxonomy_vocabulary_load_multiple_alter in OG Vocabulary 7

Implements hook_query_TAG_alter().

Alter loading vocabularies. If the static variable is set to "skip", no altering will occour.

See also

og_vocab_machine_name_validate()

1 string reference to 'og_vocab_query_taxonomy_vocabulary_load_multiple_alter'
og_vocab_machine_name_validate in ./og_vocab.module
Element validate; Auto-set a new machine name if vocabulary already exists.

File

./og_vocab.module, line 929
Give each group its own system controlled vocabularies.

Code

function og_vocab_query_taxonomy_vocabulary_load_multiple_alter(QueryAlterableInterface $query) {
  $cache =& drupal_static(__FUNCTION__, FALSE);
  if ($cache == 'skip') {
    return;
  }
  if ($cache) {

    // Prevent recursion.
    return;
  }
  $cache = TRUE;
  if (!($context = og_vocab_is_group_admin_context())) {
    return;
  }
  $group_type = $context['group_type'];
  $gid = $context['gid'];
  $query
    ->innerJoin('og_vocab_relation', 'ogr', 'ogr.vid = base.vid');
  $query
    ->condition('ogr.group_type', $group_type)
    ->condition('ogr.gid', $gid);
}