summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/book/views_plugin_argument_default_book_root.inc
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/modules/book/views_plugin_argument_default_book_root.inc')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/book/views_plugin_argument_default_book_root.inc21
1 files changed, 21 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/book/views_plugin_argument_default_book_root.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/book/views_plugin_argument_default_book_root.inc
new file mode 100644
index 0000000..1ce3046
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/book/views_plugin_argument_default_book_root.inc
@@ -0,0 +1,21 @@
+<?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'];
+ }
+ }
+ }
+}