Automattic\WooCommerce\Internal\Admin\Settings

Utils::order_map_normalize │ public static │ WC 1.0

Normalize an order map.

Sort the order map by the order and ensure the order values start from 0 and are consecutive.

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

Хуков нет.

Возвращает

array. The normalized order map.

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

$result = Utils::order_map_normalize( $order_map ): array;
$order_map(массив) (обязательный)
The order map.

Код Utils::order_map_normalize() WC 11.3.0

public static function order_map_normalize( array $order_map ): array {
	// Remove entries with non-string keys (legacy/corrupt data).
	$order_map = array_filter(
		$order_map,
		fn( $key ) => is_string( $key ),
		ARRAY_FILTER_USE_KEY
	);

	asort( $order_map );

	return array_flip( array_keys( $order_map ) );
}