Automattic\WooCommerce\Blocks\BlockTypes
ComingSoon::enqueue_assets
Enqueue frontend assets for this block, just in time for rendering.
Method of the class: ComingSoon{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->enqueue_assets( $attributes, $content, $block );
- $attributes(array) (required)
- Any attributes that currently are available from the block.
- $content(string) (required)
- The block content.
- $block(WP_Block) (required)
- The block object.
ComingSoon::enqueue_assets() ComingSoon::enqueue assets code WC 10.9.4
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' )
);
}
}