Automattic\WooCommerce\Blocks\BlockTypes
ComingSoon::enqueue_assets
Enqueue frontend assets for this block, just in time for rendering.
Метод класса: ComingSoon{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->enqueue_assets( $attributes, $content, $block );
- $attributes(массив) (обязательный)
- Any attributes that currently are available from the block.
- $content(строка) (обязательный)
- The block content.
- $block(WP_Block) (обязательный)
- The block object.
Код ComingSoon::enqueue_assets() ComingSoon::enqueue assets WC 11.1.0
protected function enqueue_assets( array $attributes, $content, $block ) {
parent::enqueue_assets( $attributes, $content, $block );
if ( isset( $attributes['style']['color']['background'] ) ) {
wp_add_inline_style(
'wc-blocks-style',
':root{--woocommerce-coming-soon-color: ' . esc_html( $attributes['style']['color']['background'] ) . '}'
);
} elseif ( isset( $attributes['color'] ) ) {
// Deprecated: To support coming soon templates created before WooCommerce 9.8.0.
wp_add_inline_style(
'wc-blocks-style',
':root{--woocommerce-coming-soon-color: ' . esc_html( $attributes['color'] ) . '}'
);
wp_enqueue_style(
'woocommerce-coming-soon',
WC()->plugin_url() . '/assets/css/coming-soon-entire-site-deprecated' . ( is_rtl() ? '-rtl' : '' ) . '.css',
array(),
Constants::get_constant( 'WC_VERSION' )
);
}
}