diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 56030cb..5bf8807 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -213,6 +213,12 @@ drupal.machine-name: - core/drupal - core/drupalSettings +drupal.print: + version: VERSION + css: + theme: + misc/print.css: {} + drupal.progress: version: VERSION js: diff --git a/core/modules/book/book.module b/core/modules/book/book.module index c034ed6..643f855 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -478,6 +478,7 @@ function template_preprocess_book_export_html(&$variables) { $variables['base_url'] = $base_url; $variables['language'] = $language_interface; $variables['language_rtl'] = ($language_interface->getDirection() == LanguageInterface::DIRECTION_RTL); + // @todo Populate HEAD somehow. $variables['head'] = drupal_get_html_head(); // HTML element attributes. diff --git a/core/modules/book/src/Controller/BookController.php b/core/modules/book/src/Controller/BookController.php index 2f89937..9d97f52 100644 --- a/core/modules/book/src/Controller/BookController.php +++ b/core/modules/book/src/Controller/BookController.php @@ -154,7 +154,12 @@ public function bookExport($type, NodeInterface $node) { } $exported_book = $this->bookExport->{$method}($node); - return new Response(drupal_render($exported_book)); + // @todo Does not work! + drupal_process_attached($exported_book); + // @todo Probably renderRoot() is not needed here. + $content = \Drupal::service('renderer')->renderRoot($exported_book); + $responce = new Response($content); + return $responce; } } diff --git a/core/modules/book/templates/book-export-html.html.twig b/core/modules/book/templates/book-export-html.html.twig index 5fb2e97..1799b9b 100644 --- a/core/modules/book/templates/book-export-html.html.twig +++ b/core/modules/book/templates/book-export-html.html.twig @@ -24,7 +24,7 @@ {{ title }} {{ page.head }} - + {{ attach_library('core/drupal.print') }} {# diff --git a/core/themes/classy/templates/layout/book-export-html.html.twig b/core/themes/classy/templates/layout/book-export-html.html.twig index ea33648..8904e3e 100644 --- a/core/themes/classy/templates/layout/book-export-html.html.twig +++ b/core/themes/classy/templates/layout/book-export-html.html.twig @@ -22,7 +22,7 @@ {{ title }} {{ page.head }} - + {{ attach_library('core/drupal.print') }} {#