Automattic\WooCommerce\Blocks

AssetsController::add_deprecated_script_handle_warnings │ private │ WC 1.0

Add console warnings for deprecated script handles.

Method of the class: AssetsController{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->add_deprecated_script_handle_warnings( $handles ): void;
$handles(array) (required)
Deprecated script handles.

AssetsController::add_deprecated_script_handle_warnings() code WC 11.1.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 )
		);
	}
}