You are here

public function TwigThemeTestController::linkGeneratorRender in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php \Drupal\twig_theme_test\TwigThemeTestController::linkGeneratorRender()

Renders for testing link_generator functions in a Twig template.

1 string reference to 'TwigThemeTestController::linkGeneratorRender'
twig_theme_test.routing.yml in core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml

File

core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php, line 51

Class

TwigThemeTestController
Controller routines for Twig theme test routes.

Namespace

Drupal\twig_theme_test

Code

public function linkGeneratorRender() {
  return [
    '#theme' => 'twig_theme_test_link_generator',
    '#test_url' => new Url('user.register', [], [
      'absolute' => TRUE,
    ]),
    '#test_url_attribute' => new Url('user.register', [], [
      'attributes' => [
        'foo' => 'bar',
      ],
    ]),
    // Explicitly creating an Attribute object to avoid false positives when
    // testing Attribute object merging with the twig link() function.
    '#attributes' => new Attribute([
      'class' => [
        'llama',
        'kitten',
        'panda',
      ],
    ]),
  ];
}