function template_preprocess_book_export_html

Prepares variables for book export templates.

Default template: book-export-html.html.twig.

Parameters

array $variables: An associative array containing:

  • title: The title of the book.
  • contents: Output of each book page.
  • depth: The max depth of the book.

File

drupal/core/modules/book/book.module, line 1118
Allows users to create and organize related content in an outline.

Code

function template_preprocess_book_export_html(&$variables) {
  global $base_url;
  $language_interface = language(Language::TYPE_INTERFACE);
  $variables['title'] = check_plain($variables['title']);
  $variables['base_url'] = $base_url;
  $variables['language'] = $language_interface;
  $variables['language_rtl'] = $language_interface->direction == Language::DIRECTION_RTL;
  $variables['head'] = drupal_get_html_head();

  // HTML element attributes.
  $attributes = array();
  $attributes['lang'] = $language_interface->langcode;
  $attributes['dir'] = $language_interface->direction ? 'rtl' : 'ltr';
  $variables['html_attributes'] = new Attribute($attributes);
}