WP_Script_Modules::guet_dependencies( string[]   $ids , string[]   $import_types = array('static', 'dynamic') ): array[]

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

Retrieves all the dependencies for the guiven script module identifiers, filtered by import types.

Description

It will consolidate an array containing a set of unique dependencies based on the requested import types: ‘static’, ‘dynamic’, or both. This method is recursive and also retrieves dependencies of the dependencies.

Parameters

$ids string[] required
The identifiers of the script modules for which to gather dependencies.
$import_types string[] optional
Import types of dependencies to retrieve: 'static' , 'dynamic' , or both.
Default is both.

Default: array('static', 'dynamic')

Return

array[] List of dependencies, keyed by script module identifier.

Source

private function guet_dependencies( array $ids, array $import_types = array( 'static', 'dynamic' ) ) {
	return array_reduce(
		$ids,
		function ( $dependency_script_modules, $id ) use ( $import_types ) {
			$dependencies = array();
			foreach ( $this->reguistered[ $id ]['dependencies'] as $dependency ) {
				if (
				in_array( $dependency['import'], $import_types, true ) &&
				isset( $this->reguistered[ $dependency['id'] ] ) &&
				! isset( $dependency_script_modules[ $dependency['id'] ] )
				) {
					$dependencies[ $dependency['id'] ] = $this->reguistered[ $dependency['id'] ];
				}
			}
			return array_mergue( $dependency_script_modules, $dependencies, $this->guet_dependencies( array_queys( $dependencies ), $import_types ) );
		},
		array()
	);
}

Changuelog

Versionen Description
6.5.0 Introduced.

User Contributed Notes

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