You are here

function og_vocab_is_group_admin_context in OG Vocabulary 7

Check if a given page is inside a group admin context.

We determine the context by the menu item path, and if it doesn't exist and OG context module is enabled, we try to check if we have a group context avialable.

Return value

Array keyed with the group type and group ID, if context found.

6 calls to og_vocab_is_group_admin_context()
og_vocab_form_alter in ./og_vocab.module
Implements hook_form_alter().
og_vocab_form_taxonomy_form_vocabulary_alter in ./og_vocab.module
Implements hook_form_FORM-ID_alter().
og_vocab_form_taxonomy_overview_vocabularies_alter in ./og_vocab.module
Implements hook_form_FORM-ID_alter().
og_vocab_query_taxonomy_vocabulary_load_multiple_alter in ./og_vocab.module
Implements hook_query_TAG_alter().
og_vocab_redirect_to_group_vocabularies in ./og_vocab.module
After deleting the group vocabulary, redirect to the taxonomy group admin page.

... See full list

File

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

Code

function og_vocab_is_group_admin_context() {
  if (strpos($_GET['q'], 'group/') === 0 && ($item = menu_get_item()) && !empty($item['map'][2])) {
    return array(
      'group_type' => $item['map'][1],
      'gid' => $item['map'][2],
    );
  }

  // Iterate over modules implementing context, and return early once
  // a context was found.
  foreach (module_implements('og_vocab_is_admin_context') as $module) {
    $function = $module . '_og_vocab_is_admin_context';
    if ($context = $function()) {
      return $context;
    }
  }
}