WP_Scripts::get_unaliased_deps( string[] $deps ): string[]

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Gets unaliased dependencies.

Description

An alias is a dependency whose src is false. It is used as a way to bundle multiple dependencies in a single handle. This in effect flattens an alias dependency tree.

Parameters

$depsstring[]required
Dependency handles.

Return

string[] Unaliased handles.

Source

private function get_unaliased_deps( array $deps ) {
	$flattened = array();
	foreach ( $deps as $dep ) {
		if ( ! isset( $this->registered[ $dep ] ) ) {
			continue;
		}

		if ( $this->registered[ $dep ]->src ) {
			$flattened[] = $dep;
		} elseif ( $this->registered[ $dep ]->deps ) {
			array_push( $flattened, ...$this->get_unaliased_deps( $this->registered[ $dep ]->deps ) );
		}
	}
	return $flattened;
}

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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