function CommonTestController::typeLinkActiveClass
Same name in other branches
- 9 core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::typeLinkActiveClass()
- 8.9.x core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::typeLinkActiveClass()
- 10 core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::typeLinkActiveClass()
Returns links to the current page, with and without query strings.
Using #type 'link' causes these links to be rendered with the link generator.
1 string reference to 'CommonTestController::typeLinkActiveClass'
- common_test.routing.yml in core/
modules/ system/ tests/ modules/ common_test/ common_test.routing.yml - core/modules/system/tests/modules/common_test/common_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ common_test/ src/ Controller/ CommonTestController.php, line 23
Class
- CommonTestController
- Controller routines for common_test routes.
Namespace
Drupal\common_test\ControllerCode
public function typeLinkActiveClass() {
return [
'no_query' => [
'#type' => 'link',
'#title' => t('Link with no query string'),
'#url' => Url::fromRoute('<current>'),
'#options' => [
'set_active_class' => TRUE,
],
],
'with_query' => [
'#type' => 'link',
'#title' => t('Link with a query string'),
'#url' => Url::fromRoute('<current>'),
'#options' => [
'query' => [
'foo' => 'bar',
'one' => 'two',
],
'set_active_class' => TRUE,
],
],
'with_query_reversed' => [
'#type' => 'link',
'#title' => t('Link with the same query string in reverse order'),
'#url' => Url::fromRoute('<current>'),
'#options' => [
'query' => [
'one' => 'two',
'foo' => 'bar',
],
'set_active_class' => TRUE,
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.