You are here

function context_condition_bookroot::execute in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_bookroot.inc \context_condition_bookroot::execute()
  2. 7.3 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['nid'])
      ->execute()
      ->fetchField();
    $book = new stdClass();
    $book->type = $type;
    parent::execute($book, $op);
  }
}