I’m trying to render my JS script to the bottom of the page which is generated through my Plugin, I can register scripts/css fine within the header, by doing below.
public function onTwigSiteVariables() {
if($this->config->get('plugins.plugin_name.built_in_js')) {
$this->grav['assets']->addJs('plugin://plugin/path/to/file.js');
}
}
The documentation tells me that I can do the following in PHP: Add javascript to footer
$this->grav['assets']->addJs($this->grav['base_url'] . '/user/plugins/yourplugin/js/somefile.js', {group: 'bottom'});
However, this doesn’t seem to work, and instead throws me a WSOD error
$this->grav['assets']->addJs('plugin://plugin/path/to/file.js', {group: 'bottom'});
And changing this too
$this->grav['assets']->addJs('plugin://plugin/path/to/file.js', array('group' => 'bottom'));
or
$this->grav['assets']->add('plugin://plugin/path/to/file.js', array('group' => 'bottom'));
---
Doesn't render anything in the output.
So I'm a bit lost as too how I would go about doing this.
Am I missing something here?
Any help is greatly appreciated.
Nathan