WP_Script_Modules::get_sorted_dependencies │ private │ WP 6.9.0

Sorts the given script module identifiers based on their dependencies.

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.

Метод класса: WP_Script_Modules{}

Хуков нет.

Возвращает

string[]. Sorted list of script module identifiers.

Использование

$result = WP_Script_Modules::get_sorted_dependencies( $ids, $import_types, fooo ) ): array;
$ids(string[]) (обязательный)
The identifiers of the script modules to sort.
$import_types(string[])
Import types of dependencies to retrieve: 'static', 'dynamic', or both.
По умолчанию: both
fooo )(обязательный)
.

Список изменений

С версии 6.9.0 Введена.

Код WP_Script_Modules::get_sorted_dependencies() WP 7.1.4

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 );
}