Load external css and JS file in admin panel

Rafael [redcrested.net] Posted in Component Development 1 year ago

One of the requirements of my customer is to add into CustomField component is a location field. Code is working into user side of the site, but in admin panel, I can't do the ossnloadexternalcss() and ossnloadexternaljs() load the external CSS and JS files. I looked at the code to find some examples, but I couldn't find anything. So, how is the right way to load these files? At this moment, I manually put the link tag to load files, but this is a rapid workaround (aka gambiarra, in Portuguese).

Breton Rafael [redcrested.net] Replied 1 year ago

In text, I put ossn_load_external_js() and ossn_load_external_js() functions, but in code I used the ossn_new_external_css() and ossn_new_external_js(). After changing the function, the code is working. Thanks for the tip @Michael.

German Michael Z├╝lsdorff Replied 1 year ago

see line #197 in ossn.lib.javascripts

function ossn_load_external_js($name, $type = 'site')

without second parameter it defaults to site

to load it on the admin-backend, you would do a

ossn_load_external_js(YOURSCRIPT, 'admin');

the same applies to ossn_load_external_css