views_plugin_argument_default_book_root.inc 537 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * @file
  4. * Contains the book root from current node argument default plugin.
  5. */
  6. /**
  7. * Default argument plugin to get the current node's book root.
  8. */
  9. class views_plugin_argument_default_book_root extends views_plugin_argument_default_node {
  10. function get_argument() {
  11. // Use the argument_default_node plugin to get the nid argument.
  12. $nid = parent::get_argument();
  13. if (!empty($nid)) {
  14. $node = node_load($nid);
  15. if (isset($node->book['bid'])) {
  16. return $node->book['bid'];
  17. }
  18. }
  19. }
  20. }