MainContentRendererInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\Core\Render\MainContent;
  3. use Drupal\Core\Routing\RouteMatchInterface;
  4. use Symfony\Component\HttpFoundation\Request;
  5. /**
  6. * The interface for "main content" (@code _controller @endcode) renderers.
  7. *
  8. * Classes implementing this interface are able to render the main content (as
  9. * received from controllers) into a response of a certain format
  10. * (HTML, JSON …) and/or in a certain decorated manner (e.g. in the case of the
  11. * default HTML main content renderer: with a page display variant applied).
  12. */
  13. interface MainContentRendererInterface {
  14. /**
  15. * Renders the main content render array into a response.
  16. *
  17. * @param array $main_content
  18. * The render array representing the main content.
  19. * @param \Symfony\Component\HttpFoundation\Request $request
  20. * The request object, for context.
  21. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  22. * The route match, for context.
  23. *
  24. * @return \Symfony\Component\HttpFoundation\Response
  25. * The Response in the format that this implementation supports.
  26. */
  27. public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match);
  28. }