You are here

function context_condition_bookroot::execute in Context 7.3

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_bookroot.inc \context_condition_bookroot::execute()
  2. 6 plugins/context_condition_bookroot.inc \context_condition_bookroot::execute()

Overrides context_condition_node::execute

File

plugins/context_condition_bookroot.inc, line 7

Class

context_condition_bookroot
Set the context on the basis of the node type of page's book root.

Code

function execute($node, $op) {
  if ($this
    ->condition_used() && !empty($node->book['bid'])) {
    $type = db_select('node')
      ->fields('node', array(
      'type',
    ))
      ->condition('nid', $node->book['bid'])
      ->execute()
      ->fetchField();
    $book = new stdClass();
    $book->type = $type;
    parent::execute($book, $op);
  }
}