You are here

class TwigExtensionTestController in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 15
Contains \Drupal\twig_extension_test\TwigExtensionTestController.

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 array(
      '#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 array(
      '#theme' => 'twig_extension_test_function',
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
StringTranslationTrait::$stringTranslation protected property The string translation service.
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
TwigExtensionTestController::testFilterRender public function Menu callback for testing Twig filters in a Twig template.
TwigExtensionTestController::testFunctionRender public function Menu callback for testing Twig functions in a Twig template.