class KernelPreHandle

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php \Drupal\Core\StackMiddleware\KernelPreHandle
  2. 10 core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php \Drupal\Core\StackMiddleware\KernelPreHandle
  3. 9 core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php \Drupal\Core\StackMiddleware\KernelPreHandle
  4. 8.9.x core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php \Drupal\Core\StackMiddleware\KernelPreHandle

Prepares the environment after page caching ran.

Hierarchy

  • class \Drupal\Core\StackMiddleware\KernelPreHandle implements \Symfony\Component\HttpKernel\HttpKernelInterface

Expanded class hierarchy of KernelPreHandle

1 string reference to 'KernelPreHandle'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses KernelPreHandle
http_middleware.kernel_pre_handle in core/core.services.yml
Drupal\Core\StackMiddleware\KernelPreHandle

File

core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php, line 14

Namespace

Drupal\Core\StackMiddleware
View source
class KernelPreHandle implements HttpKernelInterface {
  public function __construct(protected HttpKernelInterface $httpKernel, protected DrupalKernelInterface $drupalKernel, protected RequestStack $requestStack) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) : Response {
    // \Drupal\Core\DrupalKernel::preHandle() pushes requests to the stack.
    $this->drupalKernel
      ->preHandle($request);
    try {
      return $this->httpKernel
        ->handle($request, $type, $catch);
    } finally {
      // Main requests are popped in \Drupal\Core\DrupalKernel::terminate().
      if ($type !== self::MAIN_REQUEST) {
        $this->requestStack
          ->pop();
      }
    }
  }

}

Members

Title Sort descending Modifiers Object type Summary
KernelPreHandle::handle public function
KernelPreHandle::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.