Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FragmentHandler.php

function FragmentHandler::render

Renders a URI and returns the Response content.

Available options:

  • ignore_errors: true to return an empty string in case of an error

Throws

\InvalidArgumentException when the renderer does not exist

\LogicException when no main request is being handled

2 calls to FragmentHandler::render()
LazyLoadingFragmentHandler::render in vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
Renders a URI and returns the Response content.
LazyLoadingFragmentHandler::render in vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
Renders a URI and returns the Response content.
1 method overrides FragmentHandler::render()
LazyLoadingFragmentHandler::render in vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
Renders a URI and returns the Response content.

File

vendor/symfony/http-kernel/Fragment/FragmentHandler.php, line 67

Class

FragmentHandler
Renders a URI that represents a resource fragment.

Namespace

Symfony\Component\HttpKernel\Fragment

Code

public function render(string|ControllerReference $uri, string $renderer = 'inline', array $options = []) : ?string {
    if (!isset($options['ignore_errors'])) {
        $options['ignore_errors'] = !$this->debug;
    }
    if (!isset($this->renderers[$renderer])) {
        throw new \InvalidArgumentException(\sprintf('The "%s" renderer does not exist.', $renderer));
    }
    if (!($request = $this->requestStack
        ->getCurrentRequest())) {
        throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
    }
    return $this->deliver($this->renderers[$renderer]
        ->render($uri, $request, $options));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal