You are here

class ContentControllerSubscriber in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/EventSubscriber/ContentControllerSubscriber.php \Drupal\Core\EventSubscriber\ContentControllerSubscriber

Sets the request format onto the request object.

@todo Remove this event subscriber after https://www.drupal.org/node/2092647 has landed.

Hierarchy

Expanded class hierarchy of ContentControllerSubscriber

File

core/lib/Drupal/Core/EventSubscriber/ContentControllerSubscriber.php, line 20
Contains \Drupal\Core\EventSubscriber\ContentControllerSubscriber.

Namespace

Drupal\Core\EventSubscriber
View source
class ContentControllerSubscriber implements EventSubscriberInterface {

  /**
   * Sets the _controller on a request when a _form is defined.
   *
   * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
   *   The event to process.
   */
  public function onRequestDeriveFormWrapper(GetResponseEvent $event) {
    $request = $event
      ->getRequest();
    if ($request->attributes
      ->has('_form')) {
      $request->attributes
        ->set('_controller', 'controller.form:getContentResult');
    }
  }

  /**
   * Registers the methods in this class that should be listeners.
   *
   * @return array
   *   An array of event listener definitions.
   */
  static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = array(
      'onRequestDeriveFormWrapper',
      25,
    );
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentControllerSubscriber::getSubscribedEvents static function Registers the methods in this class that should be listeners. Overrides EventSubscriberInterface::getSubscribedEvents
ContentControllerSubscriber::onRequestDeriveFormWrapper public function Sets the _controller on a request when a _form is defined.