Documentation

Asset
in package

Asset Module class.

Table of Contents

Properties

$action_hook_enqueue  : ActionHook
ActionHook instance for the enqueue action.
$action_hook_register  : ActionHook
ActionHook instance for the register action.
$deps  : array<string|int, string>
Asset dependencies.
$handle  : string
Asset handle.
$register_only  : array<string|int, mixed>|null
Asset arguments.
$src  : string
Asset source.
$ver  : string|bool
Asset version.

Methods

__toString()  : string
Custom toString magic method.
initialize()  : void
Initializes the asset.

Properties

$action_hook_enqueue

ActionHook instance for the enqueue action.

protected ActionHook $action_hook_enqueue

ActionHook instance for the enqueue action.

Tags
since
1.0.0

$action_hook_register

ActionHook instance for the register action.

protected ActionHook $action_hook_register

ActionHook instance for the register action.

Tags
since
1.0.0

$deps

Asset dependencies.

protected array<string|int, string> $deps

An array of registered script handles this script depends on.

Tags
see

$deps

link
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_enqueue_style/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_style/#parameters
since
1.0.0

$register_only

Asset arguments.

protected array<string|int, mixed>|null $register_only

Array or query string of arguments for registering a script.

Tags
see

$args

link
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_enqueue_style/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_style/#parameters
since
1.0.0

$src

Asset source.

protected string $src

Full URL of the script, or path of the script relative to the WordPress root directory.

Tags
see

$src

link
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_enqueue_style/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_style/#parameters
since
1.0.0

$ver

Asset version.

protected string|bool $ver

String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is added.

Tags
see

$ver

link
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_enqueue_style/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_script/#parameters
link
https://developer.wordpress.org/reference/functions/wp_register_style/#parameters
since
1.0.0

Methods

__toString()

Custom toString magic method.

public __toString() : string

Returns the asset as a JSON string.

Tags
since
1.0.0
Return values
string

JSON string.

initialize()

Initializes the asset.

protected initialize() : void

Sets the action hooks and adds the asset to the registry.

Tags
since
1.0.0

        
On this page

Search results