You are here

public function FragmentListener::onKernelRequest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/EventListener/FragmentListener.php \Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest()

Fixes request attributes when the path is '/_fragment'.

Parameters

GetResponseEvent $event A GetResponseEvent instance:

Throws

AccessDeniedHttpException if the request does not come from a trusted IP.

File

vendor/symfony/http-kernel/EventListener/FragmentListener.php, line 56

Class

FragmentListener
Handles content fragments represented by special URIs.

Namespace

Symfony\Component\HttpKernel\EventListener

Code

public function onKernelRequest(GetResponseEvent $event) {
  $request = $event
    ->getRequest();
  if ($request->attributes
    ->has('_controller') || $this->fragmentPath !== rawurldecode($request
    ->getPathInfo())) {
    return;
  }
  if ($event
    ->isMasterRequest()) {
    $this
      ->validateRequest($request);
  }
  parse_str($request->query
    ->get('_path', ''), $attributes);
  $request->attributes
    ->add($attributes);
  $request->attributes
    ->set('_route_params', array_replace($request->attributes
    ->get('_route_params', array()), $attributes));
  $request->query
    ->remove('_path');
}