Description of the need
When adding a JS file to your theme via the .info
file, it's automatically added to the header (i.e. between the <head>
tags of the HTML). If you instead want to add it to the footer (i.e. just before the closing <body>
tag in the HTML) you need to instead add the JS via backdrop_add_js()
in something like THEME_preprocess_page()
, which allows you to specify 'scope' => 'footer'
.
Proposed solution
It'd be nice if we could instead do something like this in the .info
file:
scripts[footer][] = js/my_footer.js
That'd be much simpler and, IMO, the more expected solution.
Alternatives that have been considered
The current solution works well enough, it's just not as easy/obvious.
Additional information
Here's a question in the forum of someone expecting this functionality but finding it didn't work: https://forum.backdropcms.org/forum/how-add-custom-js-template-head-or-f...
Draft of feature description for Press Release (1 paragraph at most)
Backdrop now allows themes to add javascript files to the footer directly from the .info
file.
Recent comments
Hi, Thank you I know and use the Prepopulate module. But what I need is more information from a Node when I enter a reference (other fields should be loaded) Example, if...
Porting of module "Entity reference autofill"
From within the view: From the listing of views: I'm not aware of a simple way to revert all views to their default in one operation.
How to reset wrong Lateral-Layout-Settings especially view "promoted content"
Hi Waldi, I'm not sure if it allows to implement your use case, but there is a Backdrop module which sounds as if it could be helpful: Prepopulate. If you give it a try, be sure to have a look...
Porting of module "Entity reference autofill"