You are here

public function TestsController::testI18n in Bamboo Twig 8.5

Same name and namespace in other branches
  1. 8.2 tests/modules/bamboo_twig_test/src/Controller/TestsController.php \Drupal\bamboo_twig_test\Controller\TestsController::testI18n()
  2. 8.3 tests/modules/bamboo_twig_test/src/Controller/TestsController.php \Drupal\bamboo_twig_test\Controller\TestsController::testI18n()
  3. 8.4 tests/modules/bamboo_twig_test/src/Controller/TestsController.php \Drupal\bamboo_twig_test\Controller\TestsController::testI18n()

Internationalization page.

1 string reference to 'TestsController::testI18n'
bamboo_twig_test.routing.yml in tests/modules/bamboo_twig_test/bamboo_twig_test.routing.yml
tests/modules/bamboo_twig_test/bamboo_twig_test.routing.yml

File

tests/modules/bamboo_twig_test/src/Controller/TestsController.php, line 64

Class

TestsController
Returns renderer-responses for testing Twig functions/filters on templates.

Namespace

Drupal\bamboo_twig_test\Controller

Code

public function testI18n() {
  $nodeStorage = $this
    ->entityTypeManager()
    ->getStorage('node');
  return [
    '#variables' => [
      'articles' => [
        0 => $nodeStorage
          ->load(1),
        1 => $nodeStorage
          ->load(2),
        2 => $nodeStorage
          ->load(3),
        3 => $nodeStorage
          ->load(4),
        4 => $nodeStorage
          ->load(5),
      ],
      'datetime' => \DateTime::createFromFormat('d-m-Y', '24-07-2014'),
      'datetimeplus' => DateTimePlus::createFromFormat('d-m-Y', '24-07-2014'),
      'drupaldatetime' => DrupalDateTime::createFromFormat('d-m-Y', '24-07-2014'),
    ],
    '#theme' => 'bamboo_twig_test_i18n',
  ];
}