class Scripts (View source)

Collects information about which JavaScript files and objects are necessary to render the page and generates the relevant code.

Methods

__construct()

Generates new Scripts objects

void
addFile(string $filename, array $params = [])

Adds a new file to the list of scripts

void
addFiles(array $filelist)

Add new files to the list of scripts

void
addCode(string $code)

Adds a new code snippet to the code to be executed

array
getFiles()

Returns a list with filenames and a flag to indicate whether to register onload events for this file

string
getDisplay()

Renders all the JavaScript file inclusions, code and events

Details

__construct()

Generates new Scripts objects

void addFile(string $filename, array $params = [])

Adds a new file to the list of scripts

Parameters

string $filename

The name of the file to include

array $params

Additional parameters to pass to the file

Return Value

void

void addFiles(array $filelist)

Add new files to the list of scripts

Parameters

array $filelist

The array of file names

Return Value

void

void addCode(string $code)

Adds a new code snippet to the code to be executed

Parameters

string $code

The JS code to be added

Return Value

void

array getFiles()

Returns a list with filenames and a flag to indicate whether to register onload events for this file

Return Value

array

string getDisplay()

Renders all the JavaScript file inclusions, code and events

Return Value

string