function ThemeTestController::testInlineTemplate

Same name in other branches
  1. 9 core/modules/system/tests/modules/theme_test/src/ThemeTestController.php \Drupal\theme_test\ThemeTestController::testInlineTemplate()
  2. 8.9.x core/modules/system/tests/modules/theme_test/src/ThemeTestController.php \Drupal\theme_test\ThemeTestController::testInlineTemplate()
  3. 10 core/modules/system/tests/modules/theme_test/src/ThemeTestController.php \Drupal\theme_test\ThemeTestController::testInlineTemplate()

Tests the inline template functionality.

Return value

array A render array containing an inline template.

1 string reference to 'ThemeTestController::testInlineTemplate'
theme_test.routing.yml in core/modules/system/tests/modules/theme_test/theme_test.routing.yml
core/modules/system/tests/modules/theme_test/theme_test.routing.yml

File

core/modules/system/tests/modules/theme_test/src/ThemeTestController.php, line 47

Class

ThemeTestController
Controller routines for theme test routes.

Namespace

Drupal\theme_test

Code

public function testInlineTemplate() {
    $element = [];
    $element['test'] = [
        '#type' => 'inline_template',
        '#template' => 'test-with-context {{ llama }}',
        '#context' => [
            'llama' => 'social',
        ],
    ];
    return $element;
}

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