Scripts
extends PlatformUtility
in package
Provides access to scripts utility functions.
Tags
Table of Contents
- add() : void
- Add a script.
- html() : string
- Get the html for scripts for a location.
- importMap() : mixed
- Returns a json object with javascript relative path to absolute external path mappings
- inject() : string
- Inject all added scripts into the specified location.
- insertCustomScript() : string
- Fetches the evaluated content of a template file.
- list() : array<string|int, mixed>
- Get the list of all added scripts for a location.
Methods
add()
Add a script.
public
add(array<string|int, mixed> $script[, string $location = self::LOCATION_DEFAULT ]) :
void
Parameters
- $script : array<string|int, mixed>
- $location : string = self::LOCATION_DEFAULT
Tags
Return values
void —html()
Get the html for scripts for a location.
public
html([string $location = self::LOCATION_DEFAULT ]) :
string
Parameters
- $location : string = self::LOCATION_DEFAULT
Tags
Return values
string —importMap()
Returns a json object with javascript relative path to absolute external path mappings
public
importMap() :
mixed
Tags
Return values
mixed —inject()
Inject all added scripts into the specified location.
public
inject([string $location = self::LOCATION_DEFAULT ]) :
string
Parameters
- $location : string = self::LOCATION_DEFAULT
Tags
Return values
string —insertCustomScript()
Fetches the evaluated content of a template file.
public
insertCustomScript(string $location) :
string
Parameters
- $location : string
-
one of 'head', 'body', or 'body-bottom'
Tags
Return values
string —the content of the template file, or an error message if the location is invalid
list()
Get the list of all added scripts for a location.
public
list([string $location = self::LOCATION_DEFAULT ]) :
array<string|int, mixed>
Parameters
- $location : string = self::LOCATION_DEFAULT