3 namespace Drupal\Core\Render;
6 * Bare HTML page renderer.
8 * By "bare HTML page", we mean that the following hooks that allow for "normal"
9 * pages are not invoked:
10 * - hook_page_attachments()
11 * - hook_page_attachments_alter()
13 * - hook_page_bottom()
15 * Examples of bare HTML pages are:
20 * - exception handlers
22 * i.e. use this when rendering HTML pages in limited environments. Otherwise,
23 * use a @code _controller @endcode route, and return a render array.
24 * This will cause a main content renderer
25 * (\Drupal\Core\Render\MainContent\MainContentRendererInterface) to be
26 * used, and in case of a HTML request that will be
27 * \Drupal\Core\Render\MainContent\HtmlRenderer.
29 * In fact, this is not only *typically* used in a limited environment, it even
30 * *must* be used in a limited environment: when using the bare HTML page
31 * renderer, use as little state/additional services as possible, because the
32 * same safeguards aren't present (precisely because this is intended to be used
33 * in a limited environment).
35 * Currently, there are two types of bare pages available:
36 * - Install (hook_preprocess_install_page(), install-page.html.twig).
37 * - Maintenance (hook_preprocess_maintenance_page(),
38 * maintenance-page.html.twig).
40 * @see \Drupal\Core\Render\MainContent\HtmlRenderer
42 interface BareHtmlPageRendererInterface {
45 * Renders a bare page.
47 * @param array $content
48 * The main content to render in the 'content' region.
49 * @param string $title
50 * The title for this maintenance page.
51 * @param string $page_theme_property
52 * The #theme property to set on #type 'page'.
53 * @param array $page_additions
54 * Additional regions to add to the page. May also be used to pass the
55 * #show_messages property for #type 'page'.
57 * @return \Drupal\Core\Render\HtmlResponse
58 * The rendered HTML response, ready to be sent.
60 public function renderBarePage(array $content, $title, $page_theme_property, array $page_additions = []);