public function EmbedTestController::testAccess in Embed 8
1 string reference to 'EmbedTestController::testAccess'
- embed_test.routing.yml in tests/
embed_test/ embed_test.routing.yml - tests/embed_test/embed_test.routing.yml
File
- tests/
embed_test/ src/ Controller/ EmbedTestController.php, line 16
Class
- EmbedTestController
- Returns responses for Embed Test module routes.
Namespace
Drupal\embed_test\ControllerCode
public function testAccess(Request $request, EditorInterface $editor, EmbedButtonInterface $embed_button) {
$text = $request
->get('value');
$response = new HtmlResponse([
'#markup' => $text,
'#cache' => [
'contexts' => [
'url.query_args:value',
],
],
]);
if ($text == '') {
$response
->setStatusCode(404);
}
return $response;
}