Security update to Drupal 8.4.6
[yaffs-website] / web / modules / contrib / embed / tests / embed_test / src / Controller / EmbedTestController.php
1 <?php
2
3 namespace Drupal\embed_test\Controller;
4
5 use Drupal\Core\Controller\ControllerBase;
6 use Drupal\Core\Render\HtmlResponse;
7 use Drupal\editor\EditorInterface;
8 use Drupal\embed\EmbedButtonInterface;
9 use Symfony\Component\HttpFoundation\Request;
10
11 /**
12  * Returns responses for Embed Test module routes.
13  */
14 class EmbedTestController extends ControllerBase {
15
16   public function testAccess(Request $request, EditorInterface $editor, EmbedButtonInterface $embed_button) {
17     $text = $request->get('value');
18
19     $response = new HtmlResponse([
20       '#markup' => $text,
21       '#cache' => [
22         'contexts' => ['url.query_args:value'],
23       ],
24     ]);
25
26     if ($text == '') {
27       $response->setStatusCode(404);
28     }
29
30     return $response;
31   }
32
33 }