You are here

function Root::get_argument in Views (for Drupal 7) 8.3

Return the default argument.

This needs to be overridden by every default argument handler to properly do what is needed.

Overrides Node::get_argument

File

lib/Views/book/Plugin/views/argument_default/Root.php, line 25
Definition of Views\book\Plugin\views\argument_default\Root.

Class

Root
Default argument plugin to get the current node's book root.

Namespace

Views\book\Plugin\views\argument_default

Code

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'];
    }
  }
}