public function JqueryUiTestAssetsController::build in Drupal 9
Provides a page that loads a library.
Parameters
string $library: A pipe delimited list of library names.
Return value
array The render array.
1 string reference to 'JqueryUiTestAssetsController::build'
- jqueryui_library_assets_test.routing.yml in core/
modules/ system/ tests/ modules/ jqueryui_library_assets_test/ jqueryui_library_assets_test.routing.yml - core/modules/system/tests/modules/jqueryui_library_assets_test/jqueryui_library_assets_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ jqueryui_library_assets_test/ src/ Controller/ JqueryUiTestAssetsController.php, line 21
Class
- JqueryUiTestAssetsController
- Controller for testing jQuery UI asset loading order.
Namespace
Drupal\jqueryui_library_assets_test\ControllerCode
public function build($library) {
// If there are pipes in $library, they are separating multiple library
// names.
if (strpos($library, '|') !== FALSE) {
$library = explode('|', $library);
$library = array_map(function ($item) {
return "core/{$item}";
}, $library);
}
else {
$library = "core/{$library}";
}
return [
'#markup' => 'I am a page for testing jQuery UI asset loading order.',
'#attached' => [
'library' => $library,
],
];
}