BigPipeSessionlessTestController.php in Sessionless BigPipe 8
File
tests/modules/big_pipe_sessionless_test/src/BigPipeSessionlessTestController.php
View source
<?php
namespace Drupal\big_pipe_sessionless_test;
use Drupal\big_pipe_test\BigPipeTestController;
use Drupal\Core\Url;
class BigPipeSessionlessTestController extends BigPipeTestController {
public function test() {
$build = parent::test();
$has_session = \Drupal::service('session_configuration')
->hasSession(\Drupal::requestStack()
->getMasterRequest());
if (!$has_session) {
unset($build['html_attribute_value_subset']);
}
$build['active_link'] = [
'#type' => 'link',
'#title' => 'This should be marked active',
'#url' => Url::fromRoute('big_pipe_sessionless_test'),
'#options' => [
'set_active_class' => TRUE,
],
];
$build['inactive_link'] = [
'#type' => 'link',
'#title' => 'This should be marked inactive',
'#url' => Url::fromRoute('<front>'),
'#options' => [
'set_active_class' => TRUE,
],
];
return $build;
}
}