Automattic\WooCommerce\Blocks

AssetsController::add_deprecated_script_handle_warnings │ private │ WC 1.0

Add console warnings for deprecated script handles.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->add_deprecated_script_handle_warnings( $handles ): void;
$handles(массив) (обязательный)
Deprecated script handles.

Код AssetsController::add_deprecated_script_handle_warnings() WC 11.2.2

private function add_deprecated_script_handle_warnings( array $handles ): void {
	foreach ( $handles as $handle ) {
		$message = wp_json_encode(
			sprintf(
				'[WooCommerce] The "%s" script handle is a deprecated compatibility placeholder and does not load a script. See the enqueueable packages documentation: https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/client/blocks/docs/internal-developers/enqueueable-packages',
				$handle
			)
		);

		if ( false === $message ) {
			continue;
		}

		$this->api->add_inline_script(
			$handle,
			sprintf( 'console.warn( %s );', $message )
		);
	}
}