You are here

function context_og_context_page_condition in Context OG 6.3

Same name and namespace in other branches
  1. 6.2 context_og.module \context_og_context_page_condition()
  2. 7.2 context_og.module \context_og_context_page_condition()
  3. 7 context_og.module \context_og_context_page_condition()

Implementation of hook_context_page_condition().

This needs to run after Organic Groups' hook_init() because we need the group context to be set.

It also needs to run after Views processes arguments because og_views provides argument handlers that set OG's group context.

File

./context_og.module, line 86

Code

function context_og_context_page_condition() {
  $group = og_get_group_context();

  // Only execute the group node context condition if there is a group node
  // in context.
  if ($group) {
    $plugin = context_get_plugin('condition', 'context_og_condition_group_node');
    if ($plugin) {
      $plugin
        ->execute($group);
    }
    $plugin = context_get_plugin('condition', 'context_og_condition_member_status');
    if ($plugin) {
      $plugin
        ->execute($group);
    }
  }

  // Execute the group type context condition all the time because we want
  // to use that condition to be able to check for "no group context."
  $plugin = context_get_plugin('condition', 'context_og_condition_group_type');
  if ($plugin) {
    $plugin
      ->execute($group);
  }
}