The ScriptManager class provides the ability to queue javascript files for rendering on the frontend
| package |
CMS |
|---|---|
| since | 2.3 |
| license |
GPL |
get_script_priority() : integer
integer
set_script_priority(integer $val)
integer $valAn integer between 1 and 3. 1 being the higest priority.
queue_script(string $filename, integer $priority = null)
string $filenameThe absolute path to the filename
integer $priorityAn optional priority. If not specified the 'current' script priority will be used. Which defaults to 2.
render_scripts(string $output_path, string $entropy = null, boolean $force = false, boolean $allow_defer = true)
This method will analyze the queued scripts, and generate an output filename. if any of the queued scripts is newer than the generated output file (or the file does not exist) Then the scripts will be concatenated and placed in the output file.
string $output_pathThe location to place the concatenated scripts
string $entropySome aditional entropty to use when generating the output filename.
boolean $forceIf true the output will be generated without analyzing whether input files have changed.
boolean $allow_deferEnable the defer attribute on the script tag