Drupal 8  8.0.2
HtmlRenderer Class Reference
Inheritance diagram for HtmlRenderer:

Public Member Functions

 __construct (TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ModuleHandlerInterface $module_handler, RendererInterface $renderer, RenderCacheInterface $render_cache, array $renderer_config)
 
 renderResponse (array $main_content, Request $request, RouteMatchInterface $route_match)
 
 invokePageAttachmentHooks (array &$page)
 
 buildPageTopAndBottom (array &$html)
 

Protected Member Functions

 prepare (array $main_content, Request $request, RouteMatchInterface $route_match)
 

Protected Attributes

 $titleResolver
 
 $displayVariantManager
 
 $eventDispatcher
 
 $moduleHandler
 
 $renderer
 
 $renderCache
 
 $rendererConfig
 

Detailed Description

Default main content renderer for HTML requests.

For attachment handling of HTML responses:

See Also
template_preprocess_html()

Constructor & Destructor Documentation

__construct ( TitleResolverInterface  $title_resolver,
PluginManagerInterface  $display_variant_manager,
EventDispatcherInterface  $event_dispatcher,
ModuleHandlerInterface  $module_handler,
RendererInterface  $renderer,
RenderCacheInterface  $render_cache,
array  $renderer_config 
)

Constructs a new HtmlRenderer.

Parameters
\Drupal\Core\Controller\TitleResolverInterface$title_resolverThe title resolver.
\Drupal\Component\Plugin\PluginManagerInterface$display_variant_managerThe display variant manager.
\Symfony\Component\EventDispatcher\EventDispatcherInterface$event_dispatcherThe event dispatcher.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.
\Drupal\Core\Render\RendererInterface$rendererThe renderer service.
\Drupal\Core\Render\RenderCacheInterface$render_cacheThe render cache service.
array$renderer_configThe renderer configuration array.

References Drupal\moduleHandler().

Here is the call graph for this function:

Member Function Documentation

buildPageTopAndBottom ( array &  $html)

Invokes the page top and bottom hooks.

Parameters
array&$htmlA #type 'html' render array, for which the page top and bottom hooks will be invoked, and to which the 'page_top' and 'page_bottom' children (also render arrays) will be added (if non-empty).
Exceptions
\LogicException

References Drupal\moduleHandler().

Referenced by HtmlRenderer\renderResponse().

Here is the call graph for this function:

Here is the caller graph for this function:

invokePageAttachmentHooks ( array &  $page)

Invokes the page attachment hooks.

Parameters
array&$pageA #type 'page' render array, for which the page attachment hooks will be invoked and to which the results will be added.
Exceptions
\LogicException

References Drupal\moduleHandler(), and Drupal\theme().

Referenced by HtmlRenderer\prepare().

Here is the call graph for this function:

Here is the caller graph for this function:

prepare ( array  $main_content,
Request  $request,
RouteMatchInterface  $route_match 
)
protected

Prepares the HTML body: wraps the main content in #type 'page'.

Parameters
array$main_contentThe render array representing the main content.
\Symfony\Component\HttpFoundation\Request$requestThe request object, for context.
\Drupal\Core\Routing\RouteMatchInterface$route_matchThe route match, for context.
Returns
array An array with two values: 0. A #type 'page' render array.
  1. The page title.
Exceptions
\LogicExceptionIf the selected display variant does not implement PageVariantInterface.

References RouteMatchInterface\getRouteObject(), HtmlRenderer\invokePageAttachmentHooks(), RenderEvents\SELECT_PAGE_DISPLAY_VARIANT, and Drupal\theme().

Referenced by HtmlRenderer\renderResponse().

Here is the call graph for this function:

Here is the caller graph for this function:

renderResponse ( array  $main_content,
Request  $request,
RouteMatchInterface  $route_match 
)

{Renders the main content render array into a response.

Parameters
array$main_contentThe render array representing the main content.
\Symfony\Component\HttpFoundation\Request$requestThe request object, for context.
\Drupal\Core\Routing\RouteMatchInterface$route_matchThe route match, for context.
Returns
The Response in the format that this implementation supports.
}

The entire HTML: takes a #type 'page' and wraps it in a #type 'html'.

Implements MainContentRendererInterface.

References HtmlRenderer\buildPageTopAndBottom(), Cache\mergeContexts(), and HtmlRenderer\prepare().

Here is the call graph for this function:


The documentation for this class was generated from the following file: