function TopLevelBook::getArgument

Same name in other branches
  1. 9 core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php \Drupal\book\Plugin\views\argument_default\TopLevelBook::getArgument()
  2. 10 core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php \Drupal\book\Plugin\views\argument_default\TopLevelBook::getArgument()
  3. 11.x core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php \Drupal\book\Plugin\views\argument_default\TopLevelBook::getArgument()

Overrides Node::getArgument

File

core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php, line 62

Class

TopLevelBook
Default argument plugin to get the current node's top level book.

Namespace

Drupal\book\Plugin\views\argument_default

Code

public function getArgument() {
    // Use the argument_default_node plugin to get the nid argument.
    $nid = parent::getArgument();
    if (!empty($nid)) {
        $node = $this->nodeStorage
            ->load($nid);
        if (isset($node->book['bid'])) {
            return $node->book['bid'];
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.