00001 <?php 00002 00003 /** 00004 * Set the context on the basis of the node type of page's book root. 00005 */ 00006 class context_condition_bookroot extends context_condition_node { 00007 function execute($node, $op) { 00008 if ($this->condition_used() && !empty($node->book['bid'])) { 00009 $type = db_select('node') 00010 ->fields('node', array('type')) 00011 ->condition('nid', $node->book['nid']) 00012 ->execute() 00013 ->fetchField(); 00014 $book = new stdClass(); 00015 $book->type = $type; 00016 parent::execute($book, $op); 00017 } 00018 } 00019 }
1.4.7