You are here

context_condition_bookroot.inc in Context 6

File

plugins/context_condition_bookroot.inc
View source
<?php

/**
 * Set the context on the basis of the node type of page's book root.
 */
class context_condition_bookroot extends context_condition_node {
  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);
    }
  }

}

Classes

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