Skip to content

Commit

Permalink
Fix drupal_add_js() (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenoh authored Nov 23, 2023
1 parent 142121b commit 99dda22
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/functions/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,18 @@ function drupal_add_js(array|string|null $data = null, array|string|null $option

case 'inline':
$attachment_subscriber->addAttachments([
'js' => [$options],
'js' => $options,
]);
break;

default:
$attachment_subscriber->addAttachments([
'js' => [
$options['data'] => $options,
],
]);
if (is_string($data)) {
$attachment_subscriber->addAttachments([
'js' => [
$data => $options,
],
]);
}
}
return [];
}
Expand Down

0 comments on commit 99dda22

Please sign in to comment.