Announcement

#1 2017-01-03 21:47:01

Serge D
Member
US
2014-07-15
383

How to add JS to be loaded anywhere in admin area from active theme

Hi,

trying to find proper way to load JS script when in admin area

* Admin sets active site theme (not admin theme and not a plugin)
* add event handler which would be triggered when anywhere in Admin area
* load/add JS link to footer's get_combined js link section

Advise or better yet live example if implemented anywhere

PS: I know AdminTools plugin adds top menu but my attempt to add greydragon_add_admin_controller seems to fail as I do not think it is registered in context of admin section.
I am sure it is simple question and just a matter of using proper code from proper place :)

Offline

 

#2 2017-01-11 23:26:17

teekay
Member
2013-06-12
427

Re: How to add JS to be loaded anywhere in admin area from active theme

Use {combine_script ..} from within the respective admin/template/*.tpl file?

Last edited by teekay (2017-01-11 23:26:37)

Offline

 

#3 2017-01-12 03:40:11

Serge D
Member
US
2014-07-15
383

Re: How to add JS to be loaded anywhere in admin area from active theme

teekay wrote:

Use {combine_script ..} from within the respective admin/template/*.tpl file?

I know about how to add js reference from tpl, issue is that theme's admin templates would be loaded for theme's admin area and not entire sites admin area

Offline

 

#4 2017-01-12 10:21:42

flop25
Piwigo Team
2006-07-06
7037

Re: How to add JS to be loaded anywhere in admin area from active theme

I'm afraid that's impossible: non-admin themes are not read while being on admin section, unlike plugins which are executed everywhere
Your theme could add a companion plugin on activation, then delete files on uninstall


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2017-01-12 18:17:09

Serge D
Member
US
2014-07-15
383

Re: How to add JS to be loaded anywhere in admin area from active theme

flop25 wrote:

I'm afraid that's impossible: non-admin themes are not read while being on admin section, unlike plugins which are executed everywhere
Your theme could add a companion plugin on activation, then delete files on uninstall

companion plugin would have to be activated
can it be done automatically?

Offline

 

Notice: Undefined offset: 5 in /var/www/piwigo.org/forum/include/parser.php on line 551

#6 2017-01-12 18:40:58

flop25
Piwigo Team
2006-07-06
7037

Re: How to add JS to be loaded anywhere in admin area from active theme

apriori yes [Github] Piwigo file admin/include/plugins.class.php
and yous till can manually update the conf to enable it then do a load_conf_from_db(); . Dirty but it should works since you handle the installation for the theme already


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2017-01-12 23:02:01

Serge D
Member
US
2014-07-15
383

Re: How to add JS to be loaded anywhere in admin area from active theme

thank you
will try

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact