WP_Script_Modules::get_sorted_dependencies( string[] $ids, string[] $import_types = array(, ) ): 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.

Sorts the given script module identifiers based on their dependencies.

Description

It will return a list of script module identifiers sorted in the order they should be printed, so that dependencies are printed before the script modules that depend on them.

Parameters

$idsstring[]required
The identifiers of the script modules to sort.
$import_typesstring[]optional
Import types of dependencies to retrieve: 'static', 'dynamic', or both.
Default is both.

Default:array(, )

Return

string[] Sorted list of script module identifiers.

Source

private function get_sorted_dependencies( array $ids, array $import_types = array( 'static', 'dynamic' ) ): array {
	$sorted = array();

	foreach ( $ids as $id ) {
		$this->sort_item_dependencies( $id, $import_types, $sorted );
	}

	return array_unique( $sorted );
}

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

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