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

Breadcrumb

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

class ViewEvent

Allows to create a response for the return value of a controller.

Call setResponse() to set the response that will be returned for the current request. The propagation of this event is stopped as soon as a response is set.

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

  • class \Symfony\Contracts\EventDispatcher\Event implements \Psr\EventDispatcher\StoppableEventInterface
    • class \Symfony\Component\HttpKernel\Event\KernelEvent extends \Symfony\Contracts\EventDispatcher\Event
      • class \Symfony\Component\HttpKernel\Event\RequestEvent extends \Symfony\Component\HttpKernel\Event\KernelEvent
        • class \Symfony\Component\HttpKernel\Event\ViewEvent extends \Symfony\Component\HttpKernel\Event\RequestEvent

Expanded class hierarchy of ViewEvent

7 files declare their use of ViewEvent
FormAjaxSubscriber.php in core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
HttpKernel.php in vendor/symfony/http-kernel/HttpKernel.php
KernelEvents.php in vendor/symfony/http-kernel/KernelEvents.php
MainContentViewSubscriber.php in core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php
PsrResponseListener.php in vendor/symfony/psr-http-message-bridge/EventListener/PsrResponseListener.php

... See full list

File

vendor/symfony/http-kernel/Event/ViewEvent.php, line 26

Namespace

Symfony\Component\HttpKernel\Event
View source
final class ViewEvent extends RequestEvent {
    public function __construct(HttpKernelInterface $kernel, Request $request, int $requestType, mixed $controllerResult, ?ControllerArgumentsEvent $controllerArgumentsEvent = null) {
        parent::__construct($kernel, $request, $requestType);
    }
    public function getControllerResult() : mixed {
        return $this->controllerResult;
    }
    public function setControllerResult(mixed $controllerResult) : void {
        $this->controllerResult = $controllerResult;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
Event::$propagationStopped private property
Event::isPropagationStopped public function Is propagation stopped? Overrides StoppableEventInterface::isPropagationStopped
Event::stopPropagation public function Stops the propagation of the event to further event listeners. 1
KernelEvent::getKernel public function Returns the kernel in which this event was thrown.
KernelEvent::getRequest public function Returns the request the kernel is currently processing.
KernelEvent::getRequestType public function Returns the request type the kernel is currently processing.
KernelEvent::isMainRequest public function Checks if this is the main request.
RequestEvent::$response private property
RequestEvent::getResponse public function Returns the response object.
RequestEvent::hasResponse public function Returns whether a response was set.
RequestEvent::setResponse public function Sets a response and stops event propagation.
ViewEvent::getControllerResult public function
ViewEvent::setControllerResult public function
ViewEvent::__construct public function Overrides KernelEvent::__construct
RSS feed
Powered by Drupal