Automattic\WooCommerce\Blocks\BlockTypes

MiniCart::get_script_from_handle()protectedWC 1.0

Returns the script data given its handle.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_script_from_handle( $handle );
$handle(строка) (обязательный)
Handle of the script.

Код MiniCart::get_script_from_handle() WC 8.7.0

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;
}