Javascript Plugin building

19 views
Skip to first unread message

stef.emi...@maxcommunications.co.uk

unread,
Jul 24, 2020, 6:05:59 AM7/24/20
to AtoM Users
Hi,
I'm currently doing some modifications on a plugin and need to include some javascript. I've tried including it inline in the template _header.php and also in _footer.php but am coming up against problems, I suspect due to the order in which things are loading.

Can anyone tell me the recommended way to include javascripts in plugins, specifically to ensure that all page elements have loaded before the js kicks in?

Thanks
Stef

Steve Breker

unread,
Jul 24, 2020, 6:11:49 PM7/24/20
to AtoM Users
Hi Stef

You can add a javascript file to a plugin - AtoM's qtAccessionPlugin has a good example.

Add the javascript file to a new 'js' folder in the root of your plugin folder:

The path to the javascript file needs to be associated with the controller in the view.yml file in the plugin module's config folder:

Hopefully that helps get things up and running for you!  Let me know if you have any additional questions.

Steve

stef.emi...@maxcommunications.co.uk

unread,
Aug 3, 2020, 4:18:01 AM8/3/20
to AtoM Users
Thanks very much Steve - just back from holiday so apologies for the late response. Much appreciated.
Stef

Reply all
Reply to author
Forward
0 new messages