Automattic\WooCommerce\Blocks\BlockTypes

MiniCart::get_script_from_handle()protectedWC 1.0

Returns the script data given its handle.

Method of the class: MiniCart{}

No Hooks.

Return

\_WP_Dependency|null. Object containing the script data if found, or null.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_script_from_handle( $handle );
$handle(string) (required)
Handle of the script.

MiniCart::get_script_from_handle() code WC 9.4.2

protected function get_script_from_handle( $handle ) {
	$wp_scripts = wp_scripts();
	foreach ( $wp_scripts->registered as $script ) {
		if ( $script->handle === $handle ) {
			return $script;
		}
	}
	return null;
}