annotate core/lib/Drupal/Core/Render/BareHtmlPageRendererInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Render;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Bare HTML page renderer.
Chris@0 7 *
Chris@0 8 * By "bare HTML page", we mean that the following hooks that allow for "normal"
Chris@0 9 * pages are not invoked:
Chris@0 10 * - hook_page_attachments()
Chris@0 11 * - hook_page_attachments_alter()
Chris@0 12 * - hook_page_top()
Chris@0 13 * - hook_page_bottom()
Chris@0 14 *
Chris@0 15 * Examples of bare HTML pages are:
Chris@0 16 * - install.php
Chris@0 17 * - update.php
Chris@0 18 * - authorize.php
Chris@0 19 * - maintenance mode
Chris@0 20 * - exception handlers
Chris@0 21 *
Chris@0 22 * i.e. use this when rendering HTML pages in limited environments. Otherwise,
Chris@0 23 * use a @code _controller @endcode route, and return a render array.
Chris@0 24 * This will cause a main content renderer
Chris@0 25 * (\Drupal\Core\Render\MainContent\MainContentRendererInterface) to be
Chris@0 26 * used, and in case of a HTML request that will be
Chris@0 27 * \Drupal\Core\Render\MainContent\HtmlRenderer.
Chris@0 28 *
Chris@0 29 * In fact, this is not only *typically* used in a limited environment, it even
Chris@0 30 * *must* be used in a limited environment: when using the bare HTML page
Chris@0 31 * renderer, use as little state/additional services as possible, because the
Chris@0 32 * same safeguards aren't present (precisely because this is intended to be used
Chris@0 33 * in a limited environment).
Chris@0 34 *
Chris@0 35 * Currently, there are two types of bare pages available:
Chris@0 36 * - Install (hook_preprocess_install_page(), install-page.html.twig).
Chris@0 37 * - Maintenance (hook_preprocess_maintenance_page(),
Chris@0 38 * maintenance-page.html.twig).
Chris@0 39 *
Chris@0 40 * @see \Drupal\Core\Render\MainContent\HtmlRenderer
Chris@0 41 */
Chris@0 42 interface BareHtmlPageRendererInterface {
Chris@0 43
Chris@0 44 /**
Chris@0 45 * Renders a bare page.
Chris@0 46 *
Chris@0 47 * @param array $content
Chris@0 48 * The main content to render in the 'content' region.
Chris@0 49 * @param string $title
Chris@0 50 * The title for this maintenance page.
Chris@0 51 * @param string $page_theme_property
Chris@0 52 * The #theme property to set on #type 'page'.
Chris@0 53 * @param array $page_additions
Chris@0 54 * Additional regions to add to the page. May also be used to pass the
Chris@0 55 * #show_messages property for #type 'page'.
Chris@0 56 *
Chris@0 57 * @return \Drupal\Core\Render\HtmlResponse
Chris@0 58 * The rendered HTML response, ready to be sent.
Chris@0 59 */
Chris@0 60 public function renderBarePage(array $content, $title, $page_theme_property, array $page_additions = []);
Chris@0 61
Chris@0 62 }