You are here

function context_condition_node::execute in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_node.inc \context_condition_node::execute()
  2. 7.3 plugins/context_condition_node.inc \context_condition_node::execute()
1 call to context_condition_node::execute()
context_condition_bookroot::execute in plugins/context_condition_bookroot.inc
2 methods override context_condition_node::execute()
context_condition_bookroot::execute in plugins/context_condition_bookroot.inc
context_condition_node_taxonomy::execute in plugins/context_condition_node_taxonomy.inc

File

plugins/context_condition_node.inc, line 47

Class

context_condition_node
Expose node views/node forms of specific node types as a context condition.

Code

function execute($node, $op) {
  foreach ($this
    ->get_contexts($node->type) as $context) {

    // Check the node form option.
    $options = $this
      ->fetch_from_context($context, 'options');
    if ($op === 'form') {
      $options = $this
        ->fetch_from_context($context, 'options');
      if (!empty($options['node_form']) && in_array($options['node_form'], array(
        CONTEXT_NODE_FORM,
        CONTEXT_NODE_FORM_ONLY,
      ))) {
        $this
          ->condition_met($context, $node->type);
      }
    }
    elseif (empty($options['node_form']) || $options['node_form'] != CONTEXT_NODE_FORM_ONLY) {
      $this
        ->condition_met($context, $node->type);
    }
  }
}