3 namespace Drupal\twig_extension_test;
5 use Drupal\Core\StringTranslation\StringTranslationTrait;
8 * Controller routines for Twig extension test routes.
10 class TwigExtensionTestController {
11 use StringTranslationTrait;
14 * Menu callback for testing Twig filters in a Twig template.
16 public function testFilterRender() {
18 '#theme' => 'twig_extension_test_filter',
19 '#message' => 'Every animal is not a mineral.',
20 '#safe_join_items' => [
21 '<em>will be escaped</em>',
22 $this->t('<em>will be markup</em>'),
23 ['#markup' => '<strong>will be rendered</strong>']
29 * Menu callback for testing Twig functions in a Twig template.
31 public function testFunctionRender() {
32 return ['#theme' => 'twig_extension_test_function'];