class TestPageTestController
Same name in other branches
- 9 core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php \Drupal\test_page_test\Controller\TestPageTestController
- 8.9.x core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php \Drupal\test_page_test\Controller\TestPageTestController
- 10 core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php \Drupal\test_page_test\Controller\TestPageTestController
Controller routines for test_page_test routes.
Hierarchy
- class \Drupal\test_page_test\Controller\TestPageTestController uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of TestPageTestController
File
-
core/
modules/ system/ tests/ modules/ test_page_test/ src/ Controller/ TestPageTestController.php, line 13
Namespace
Drupal\test_page_test\ControllerView source
class TestPageTestController {
use StringTranslationTrait;
/**
* Returns a test page and sets the title.
*/
public function testPage() {
$link_text = $this->t('Visually identical test links');
return [
'#title' => $this->t('Test page'),
'#markup' => $this->t('Test page text.') . "<a href=\"/user/login\">{$link_text}</a><a href=\"/user/register\">{$link_text}</a>",
'#attached' => [
'drupalSettings' => [
'test-setting' => 'azAZ09();.,\\\\/-_{}',
],
],
];
}
/**
* Returns a test page and with the call to the dump() function.
*/
public function testPageVarDump() {
$role = Role::create([
'id' => 'test_role',
'label' => 'Test role',
]);
dump($role);
return [
'#title' => $this->t('Test page with var dump'),
'#markup' => $this->t('Test page text.'),
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 |
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. | 1 |
TestPageTestController::testPage | public | function | Returns a test page and sets the title. | |
TestPageTestController::testPageVarDump | public | function | Returns a test page and with the call to the dump() function. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.