Automattic\WooCommerce\Blocks

Assets::register_block_script()public staticWC 2.3.0

Устарела с версии 4.5.0 Block types register the scripts themselves.. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Queues a block script in the frontend.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = Assets::register_block_script( $script_name, $handle, $dependencies );
$script_name(строка) (обязательный)
Name of the script used to identify the file inside build folder.
$handle(строка)
Provided if the handle should be different than the script name. wc- prefix automatically added.
По умолчанию: ''
$dependencies(массив)
An array of registered script handles this script depends on.
По умолчанию: empty array

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

С версии 2.3.0 Введена.
С версии 2.6.0 Changed $name to $script_name and added $handle argument.
С версии 2.9.0 Made it so scripts are not loaded in admin pages.
Устарела с 4.5.0 Block types register the scripts themselves.

Код Assets::register_block_script() WC 8.7.0

public static function register_block_script( $script_name, $handle = '', $dependencies = [] ) {
	_deprecated_function( 'register_block_script', '4.5.0' );
	$asset_api = Package::container()->get( AssetApi::class );
	$asset_api->register_block_script( $script_name, $handle, $dependencies );
}