Loading Javascript and CSS Specific to your Plugin
If you need to load assets that are plugin or content specific, LEAP™ 5 has a mechanism to handle this.
The array $page_requestedAssets should be used to insert the fully qualified path from web server root of your asset.
Determining the Path
It is important to ascertain the right path to the asset. If the plugin is compiled and running as an installed LassoApp, this path will not be the same as when it is running in "open" mode.
The code below demonstrates logic to switch paths depending on the known state of the plugin.
When a plugin is installed, it can be loaded as open or compiled. The setting can be changed at any time although errors may occur if the code does not exist in the form chosen. Refer to the user documentation for Plugin Management.
If the plugin is running as compiled, the variable $isLassoApp will be 1 (ie true), else when running "open" it $isLassoApp will be 0 (false).
local(jspath = '/lasso9/glossary/glossaryActions.js')
$isLassoApp == 0 ? #jspath = '/LEAP/MODULES/glossaryActions.js'
$page_requestedAssets->insert(#jspath)
If the plugin is only ever going to be running in an uncompiled state, the path to the asset can be inserted as a simple string.
$page_requestedAssets->insert('/LEAP/MODULES/glossaryActions.js')
Permitted Asset Types
Only Javascript (.js) and CSS (.css) assets are permitted at this time.
All other file extensions loaded to the $page_requestedAssets array will be discarded.