%PDF- %PDF-
Direktori : /home/t/r/a/tradesc/www/relax/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ |
Current File : /home/t/r/a/tradesc/www/relax/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ComingSoon.php |
<?php namespace Automattic\WooCommerce\Blocks\BlockTypes; /** * ComingSoon class. */ class ComingSoon extends AbstractBlock { /** * Block name. * * @var string */ protected $block_name = 'coming-soon'; /** * It is necessary to register and enqueue assets during the render phase because we want to load assets only if the block has the content. */ protected function register_block_type_assets() { parent::register_block_type_assets(); $this->register_chunk_translations( [ $this->block_name ] ); } /** * Enqueue frontend assets for this block, just in time for rendering. * * @internal This prevents the block script being enqueued on all pages. It is only enqueued as needed. Note that * we intentionally do not pass 'script' to register_block_type. * * @param array $attributes Any attributes that currently are available from the block. * @param string $content The block content. * @param WP_Block $block The block object. */ protected function enqueue_assets( array $attributes, $content, $block ) { parent::enqueue_assets( $attributes, $content, $block ); if ( isset( $attributes['color'] ) ) { wp_add_inline_style( 'wc-blocks-style', ':root{--woocommerce-coming-soon-color: ' . esc_html( $attributes['color'] ) . '}' ); } } /** * Get the frontend script handle for this block type. * * @see $this->register_block_type() * @param string $key Data to get, or default to everything. * @return array|string|null */ protected function get_block_type_script( $key = null ) { return null; } }