function AjaxPageState::handle

Same name in other branches
  1. 10 core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php \Drupal\Core\StackMiddleware\AjaxPageState::handle()

File

core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php, line 27

Class

AjaxPageState
Expands the compressed ajax_page_state query parameter into an array.

Namespace

Drupal\Core\StackMiddleware

Code

public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) : Response {
    if ($type === static::MAIN_REQUEST) {
        if ($request->request
            ->has('ajax_page_state')) {
            $request->request
                ->set('ajax_page_state', $this->parseAjaxPageState($request->request
                ->all('ajax_page_state')));
        }
        elseif ($request->query
            ->has('ajax_page_state')) {
            $request->query
                ->set('ajax_page_state', $this->parseAjaxPageState($request->query
                ->all('ajax_page_state')));
        }
    }
    return $this->httpKernel
        ->handle($request, $type, $catch);
}

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