function BookExport::bookNodeExport

Same name in other branches
  1. 9 core/modules/book/src/BookExport.php \Drupal\book\BookExport::bookNodeExport()
  2. 8.9.x core/modules/book/src/BookExport.php \Drupal\book\BookExport::bookNodeExport()
  3. 11.x core/modules/book/src/BookExport.php \Drupal\book\BookExport::bookNodeExport()

Generates printer-friendly HTML for a node.

Parameters

\Drupal\node\NodeInterface $node: The node that will be output.

string $children: (optional) All the rendered child nodes within the current node. Defaults to an empty string.

Return value

array A render array for the exported HTML of a given node.

See also

\Drupal\book\BookExport::exportTraverse()

File

core/modules/book/src/BookExport.php, line 145

Class

BookExport
Provides methods for exporting book to different formats.

Namespace

Drupal\book

Code

protected function bookNodeExport(NodeInterface $node, $children = '') {
    $build = $this->viewBuilder
        ->view($node, 'print', NULL);
    unset($build['#theme']);
    return [
        '#theme' => 'book_node_export_html',
        '#content' => $build,
        '#node' => $node,
        '#children' => $children,
    ];
}

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