Skip to content
Snippets Groups Projects
Verified Commit ee81f7be authored by Dave Long's avatar Dave Long
Browse files

Issue #3375494 by Yujiman85, joachim, smustgrave: incorrect sample code in...

Issue #3375494 by Yujiman85, joachim, smustgrave: incorrect sample code in docs for hook_library_info_build
parent 5427d50c
No related branches found
No related tags found
No related merge requests found
......@@ -907,31 +907,31 @@ function hook_js_alter(&$javascript, \Drupal\Core\Asset\AttachedAssetsInterface
function hook_library_info_build() {
$libraries = [];
// Add a library whose information changes depending on certain conditions.
$libraries['mymodule.zombie'] = [
$libraries['zombie'] = [
'dependencies' => [
'core/once',
],
];
if (Drupal::moduleHandler()->moduleExists('minifyzombies')) {
$libraries['mymodule.zombie'] += [
$libraries['zombie'] += [
'js' => [
'mymodule.zombie.min.js' => [],
'zombie.min.js' => [],
],
'css' => [
'base' => [
'mymodule.zombie.min.css' => [],
'zombie.min.css' => [],
],
],
];
}
else {
$libraries['mymodule.zombie'] += [
$libraries['zombie'] += [
'js' => [
'mymodule.zombie.js' => [],
'zombie.js' => [],
],
'css' => [
'base' => [
'mymodule.zombie.css' => [],
'zombie.css' => [],
],
],
];
......@@ -943,7 +943,7 @@ function hook_library_info_build() {
// the library (of course) not be loaded but no notices or errors will be
// triggered.
if (Drupal::moduleHandler()->moduleExists('vampirize')) {
$libraries['mymodule.vampire'] = [
$libraries['vampire'] = [
'js' => [
'js/vampire.js' => [],
],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment