Automattic\WooCommerce\Blocks\BlockTypes
Checkout::get_block_type_script
Get the frontend script handle for this block type.
Метод класса: Checkout{}
Хуков нет.
Возвращает
Массив|Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_block_type_script( $key );
- $key(строка)
- Data to get, or default to everything.
По умолчанию: null
Заметки
- Смотрите: $this->register_block_type()
Код Checkout::get_block_type_script() Checkout::get block type script WC 10.4.0
protected function get_block_type_script( $key = null ) {
$dependencies = [];
// Load password strength meter script asynchronously if needed.
if ( ! is_user_logged_in() && 'no' === get_option( 'woocommerce_registration_generate_password' ) ) {
$dependencies[] = 'zxcvbn-async';
}
$checkout_fields = Package::container()->get( CheckoutFields::class );
// Load schema parser asynchronously if we need it.
if ( Validation::has_field_schema( $checkout_fields->get_additional_fields() ) ) {
$dependencies[] = 'wc-schema-parser';
}
$script = [
'handle' => 'wc-' . $this->block_name . '-block-frontend',
'path' => $this->asset_api->get_block_asset_build_path( $this->block_name . '-frontend' ),
'dependencies' => $dependencies,
];
return $key ? $script[ $key ] : $script;
}