LLMS_Assets::define( string $type, array[] $assets )

Define a list of assets by type so they can be enqueued or registered later.


Description Description

If an asset is already defined, redefining it will overwrite the previous definition.


Top ↑

Parameters Parameters

$type

(string) (Required) Asset type. Accepts 'scripts' or 'styles'.

$assets

(array[]) (Required) List of assets to define. The array key is the asset's handle. Each array value is an array of asset definitions.


Top ↑

Return Return

(array[]) Returns the updated list of defined assets.


Top ↑

Source Source

File: includes/class-llms-assets.php

	 * @return array[] Returns the updated list of defined assets.
	 */
	public function define( $type, $assets ) {

		if ( ! in_array( $type, array( 'scripts', 'styles' ), true ) ) {
			return false;
		}

		foreach ( $assets as $handle => $definition ) {
			$this->{$type}[ $handle ] = $definition;
		}

		return $this->$type;

Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.