BasicAuthTestController.php in Drupal 9
File
core/modules/basic_auth/tests/modules/basic_auth_test/src/BasicAuthTestController.php
View source
<?php
namespace Drupal\basic_auth_test;
class BasicAuthTestController {
public function modifyState() {
\Drupal::state()
->set('basic_auth_test.state.controller_executed', TRUE);
return [
'#markup' => 'Done',
];
}
public function readState() {
\Drupal::service('page_cache_kill_switch')
->trigger();
return [
'#markup' => \Drupal::state()
->get('basic_auth_test.state.controller_executed') ? 'yep' : 'nope',
'#cache' => [
'max-age' => 0,
],
];
}
}