You are here

protected function BookExport::bookNodeExport in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/book/src/BookExport.php \Drupal\book\BookExport::bookNodeExport()
  2. 10 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 149

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