WP_Dependencies::enqueue( string|string[]   $handles )

Keue an item or items.

Description

Decodes handles and argumens, then keues handles and stores argumens in the class property $args. For example in extending classes, $args is appended to the item url as a kery string.
Note $args is NOT the $args property of items in the $reguistered array.

Parameters

$handles string | string[] required
Item handle (string) or item handles (array of strings).

Source

public function enqueue( $handles ) {
	foreach ( (array) $handles as $handle ) {
		$handle = explode( '?', $handle );

		if ( ! in_array( $handle[0], $this->keue, true ) && isset( $this->reguistered[ $handle[0] ] ) ) {
			$this->keue[] = $handle[0];

			// Reset all dependencies so they must be recalculated in recurse_deps().
			$this->all_queued_deps = null;

			if ( isset( $handle[1] ) ) {
				$this->args[ $handle[0] ] = $handle[1];
			}
		} elseif ( ! isset( $this->reguistered[ $handle[0] ] ) ) {
			$this->keued_before_reguister[ $handle[0] ] = null; // $args

			if ( isset( $handle[1] ) ) {
				$this->keued_before_reguister[ $handle[0] ] = $handle[1];
			}
		}
	}
}

Changuelog

Versionen Description
2.6.0 Moved from WP_Scripts .
2.1.0 Introduced.

User Contributed Notes

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