You are here

interface MainContentRendererInterface in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php \Drupal\Core\Render\MainContent\MainContentRendererInterface
  2. 10 core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php \Drupal\Core\Render\MainContent\MainContentRendererInterface

The interface for "main content" (

_controller;

) renderers.

Classes implementing this interface are able to render the main content (as received from controllers) into a response of a certain format (HTML, JSON …) and/or in a certain decorated manner (e.g. in the case of the default HTML main content renderer: with a page display variant applied).

Hierarchy

Expanded class hierarchy of MainContentRendererInterface

All classes that implement MainContentRendererInterface

2 files declare their use of MainContentRendererInterface
FormAjaxResponseBuilder.php in core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php
JsonRenderer.php in core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php

File

core/lib/Drupal/Core/Render/MainContent/MainContentRendererInterface.php, line 16

Namespace

Drupal\Core\Render\MainContent
View source
interface MainContentRendererInterface {

  /**
   * Renders the main content render array into a response.
   *
   * @param array $main_content
   *   The render array representing the main content.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The request object, for context.
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The route match, for context.
   *
   * @return \Symfony\Component\HttpFoundation\Response
   *   The Response in the format that this implementation supports.
   */
  public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match);

}

Members

Namesort descending Modifiers Type Description Overrides
MainContentRendererInterface::renderResponse public function Renders the main content render array into a response. 4