materio-base-legacy/modules/book/views_plugin_argument_default_book_root.inc
bachy b20b38f514 first import
Signed-off-by: bachy <git@g-u-i.net>
2013-01-09 10:53:26 +01:00

22 lines
537 B
PHP

<?php
/**
* @file
* Contains the book root from current node argument default plugin.
*/
/**
* Default argument plugin to get the current node's book root.
*/
class views_plugin_argument_default_book_root extends views_plugin_argument_default_node {
function get_argument() {
// Use the argument_default_node plugin to get the nid argument.
$nid = parent::get_argument();
if (!empty($nid)) {
$node = node_load($nid);
if (isset($node->book['bid'])) {
return $node->book['bid'];
}
}
}
}