You are here

function context_og_condition_group_type::execute in Context OG 6.3

Same name and namespace in other branches
  1. 7.2 plugins/context_og_condition_group_type.inc \context_og_condition_group_type::execute()
  2. 7 plugins/context_og_condition_group_type.inc \context_og_condition_group_type::execute()

File

plugins/context_og_condition_group_type.inc, line 30

Class

context_og_condition_group_type
Expose organic groups group types as a context condition.

Code

function execute($group) {
  $type = isset($group) ? $group->type : '_none_';
  $node_form = arg(0) == 'node' && (is_numeric(arg(1)) && arg(2) == 'edit' || arg(1) == 'add');
  $contexts = $this
    ->get_contexts($type);
  $this->values[$type] = array();
  foreach ($contexts as $context) {
    $options = $this
      ->fetch_from_context($context, 'options');

    // The condition is met unless we are looking at a node form
    // and the "Set on node form" option is unchecked.
    if (!$node_form || !empty($options['node_form'])) {
      $this
        ->condition_met($context, $type);
    }
  }
}