PHP Class Inpsyde\MultilingualPress\Asset\DebugAwareScript

Since: 3.0.0
Inheritance: implements Inpsyde\MultilingualPress\Asset\Script
Datei anzeigen Open project: inpsyde/multilingual-press Class Usage Examples

Public Methods

Method Description
__construct ( string $handle, string $url, array $dependencies = [], string | null $version = '' ) Constructor. Sets up the properties.
__toString ( ) : string Returns the handle.
add_data ( string $object_name, array $data ) : static Makes the given data available for the script.
clear_data ( ) : static Clears the data so it won't be output another time.
data ( ) : array[] Returns all data to be made available for the script.
dependencies ( ) : string[] Returns the dependencies.
from_location ( string $handle, AssetLocation $location, array $dependencies = [], string | null $version = '' ) : static Returns a new script object, instantiated according to the given arguments.
handle ( ) : string Returns the handle.
url ( ) : string Returns the file URL.
version ( ) : string | null Returns the file version.

Method Details

__construct() public method

Constructor. Sets up the properties.
Since: 3.0.0
public __construct ( string $handle, string $url, array $dependencies = [], string | null $version = '' )
$handle string The handle.
$url string The public URL for the directory containing the file.
$dependencies array Optional. The dependencies. Defaults to empty array.
$version string | null Optional. Version of the file. Defaults to empty string.

__toString() public method

Returns the handle.
Since: 3.0.0
public __toString ( ) : string
return string The handle.

add_data() public method

Makes the given data available for the script.
Since: 3.0.0
public add_data ( string $object_name, array $data ) : static
$object_name string The name of the JavaScript variable holding the data.
$data array The data to be made available for the script.
return static Script instance.

clear_data() public method

Clears the data so it won't be output another time.
Since: 3.0.0
public clear_data ( ) : static
return static Script instance.

data() public method

Returns all data to be made available for the script.
Since: 3.0.0
public data ( ) : array[]
return array[] Data to be made available for the script.

dependencies() public method

Returns the dependencies.
Since: 3.0.0
public dependencies ( ) : string[]
return string[] The dependencies.

from_location() public static method

Returns a new script object, instantiated according to the given arguments.
Since: 3.0.0
public static from_location ( string $handle, AssetLocation $location, array $dependencies = [], string | null $version = '' ) : static
$handle string The handle.
$location AssetLocation Location object.
$dependencies array Optional. The dependencies. Defaults to empty array.
$version string | null Optional. Version of the file. Defaults to empty string.
return static Script object.

handle() public method

Returns the handle.
Since: 3.0.0
public handle ( ) : string
return string The handle.

url() public method

Returns the file URL.
Since: 3.0.0
public url ( ) : string
return string The file URL.

version() public method

Returns the file version.
Since: 3.0.0
public version ( ) : string | null
return string | null The file version.