Skip to content

Commit

Permalink
Merge pull request #6 from moreonion/csp
Browse files Browse the repository at this point in the history
feat(scripts): Improve interoperatbility with other #pre_render hooks
  • Loading branch information
torotil authored Nov 25, 2024
2 parents a5ed3b8 + 0772a04 commit 6f3214a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion theming.module
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ function theming_theme_registry_alter(&$hooks) {
* Implements hook_element_info_alter().
*/
function theming_element_info_alter(&$info) {
$info['scripts']['#pre_render'] = ['theming_pre_render_scripts'];
// Replace the default #pre_render callback for scripts.
$info['scripts']['#pre_render'] = array_map(function ($hook) {
return $hook == 'drupal_pre_render_scripts' ? 'theming_pre_render_scripts' : $hook;
}, $info['scripts']['#pre_render']);
}

/**
Expand Down

0 comments on commit 6f3214a

Please sign in to comment.