Hi, I couldnt find any solution for this.
I am loading multiple javascript files in my template:
scripts[] = js/swiper-bundle.min.js
scripts[] = js/custom-apps.js
scripts[] = js/custom-leaflet.js
...
Some of the files I want to render in the header and some in the footer.
But this doesnt work:
scripts["header"] = js/swiper-bundle.min.js
scripts["footer"] = js/custom-apps.js
scripts["footer"] = js/custom-leaflet.js
<?php print backdrop_get_js('header'); ?>
<?php print backdrop_get_js('footer'); ?>
Hello @webtransformer 👋
Have you tried https://api.backdropcms.org/api/backdrop/core%21includes%21common.inc/fu... ?
I believe that something like this would work:
backdrop_add_js(path_to_theme() . 'js/swiper-bundle.min.js', array( 'type' => 'file', 'scope' => 'header', ) ); backdrop_add_js(path_to_theme() . 'js/custom-apps.js', array( 'type' => 'file', 'scope' => 'footer', 'weight' => 1, ) ); backdrop_add_js(path_to_theme() . 'js/custom-leaflet.js', array( 'type' => 'file', 'scope' => 'footer', 'weight' => 2, ) );Please give that a go and let us know how it goes.