function CommonTestController::jsAndCssQuerystring
Same name in other branches
- 8.9.x core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::jsAndCssQuerystring()
- 10 core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::jsAndCssQuerystring()
- 11.x core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::jsAndCssQuerystring()
Adds a JavaScript file and a CSS file with a query string appended.
Return value
string An empty string.
1 string reference to 'CommonTestController::jsAndCssQuerystring'
- 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 64
Class
- CommonTestController
- Controller routines for common_test routes.
Namespace
Drupal\common_test\ControllerCode
public function jsAndCssQuerystring() {
$module_extension_list = \Drupal::service('extension.list.module');
assert($module_extension_list instanceof ExtensionList);
$attached = [
'#attached' => [
'library' => [
'node/drupal.node',
],
'css' => [
$module_extension_list->getPath('node') . '/css/node.admin.css' => [],
// A relative URI may have a query string.
'/' . $module_extension_list->getPath('node') . '/node-fake.css?arg1=value1&arg2=value2' => [],
],
],
];
return \Drupal::service('renderer')->renderRoot($attached);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.