function BigPipeTestHooks::pageTop

Implements hook_page_top().

Attributes

#[Hook('page_top')]

File

core/modules/big_pipe/tests/modules/big_pipe_test/src/Hook/BigPipeTestHooks.php, line 17

Class

BigPipeTestHooks
Hook implementations for big_pipe_test.

Namespace

Drupal\big_pipe_test\Hook

Code

public function pageTop(array &$page_top) : void {
  // Ensure this hook is invoked on every page load.
  $page_top['#cache']['max-age'] = 0;
  $request = \Drupal::request();
  if ($request->query
    ->get('trigger_session')) {
    $request->getSession()
      ->set('big_pipe_test', TRUE);
  }
}

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