class TwigExtensionTestController

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/twig_extension_test/src/TwigExtensionTestController.php \Drupal\twig_extension_test\TwigExtensionTestController
  2. 10 core/modules/system/tests/modules/twig_extension_test/src/TwigExtensionTestController.php \Drupal\twig_extension_test\TwigExtensionTestController
  3. 8.9.x core/modules/system/tests/modules/twig_extension_test/src/TwigExtensionTestController.php \Drupal\twig_extension_test\TwigExtensionTestController

Controller routines for Twig extension test routes.

Hierarchy

Expanded class hierarchy of TwigExtensionTestController

File

core/modules/system/tests/modules/twig_extension_test/src/TwigExtensionTestController.php, line 10

Namespace

Drupal\twig_extension_test
View source
class TwigExtensionTestController {
  use StringTranslationTrait;
  
  /**
   * Menu callback for testing Twig filters in a Twig template.
   */
  public function testFilterRender() {
    return [
      '#theme' => 'twig_extension_test_filter',
      '#message' => 'Every animal is not a mineral.',
      '#safe_join_items' => [
        '<em>will be escaped</em>',
        $this->t('<em>will be markup</em>'),
        [
          '#markup' => '<strong>will be rendered</strong>',
        ],
      ],
    ];
  }
  
  /**
   * Menu callback for testing Twig functions in a Twig template.
   */
  public function testFunctionRender() {
    return [
      '#theme' => 'twig_extension_test_function',
    ];
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.