Automattic\WooCommerce\Blocks\BlockTypes

AllProducts::enqueue_data()protectedWC 1.0

Extra data passed through from server to client for block.

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

Хуков нет.

Возвращает

null. Ничего.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->enqueue_data( $attributes );
$attributes(массив)
Any attributes that currently are available from the block. Note, this will be empty in the editor context when the block is not in the post content on editor load.
По умолчанию: []

Код AllProducts::enqueue_data() WC 7.1.0

protected function enqueue_data( array $attributes = [] ) {
	parent::enqueue_data( $attributes );
	// Set this so filter blocks being used as widgets know when to render.
	$this->asset_data_registry->add( 'has_filterable_products', true, true );

	$this->asset_data_registry->add( 'min_columns', wc_get_theme_support( 'product_blocks::min_columns', 1 ), true );
	$this->asset_data_registry->add( 'max_columns', wc_get_theme_support( 'product_blocks::max_columns', 6 ), true );
	$this->asset_data_registry->add( 'default_columns', wc_get_theme_support( 'product_blocks::default_columns', 3 ), true );
	$this->asset_data_registry->add( 'min_rows', wc_get_theme_support( 'product_blocks::min_rows', 1 ), true );
	$this->asset_data_registry->add( 'max_rows', wc_get_theme_support( 'product_blocks::max_rows', 6 ), true );
	$this->asset_data_registry->add( 'default_rows', wc_get_theme_support( 'product_blocks::default_rows', 3 ), true );
	$this->hydrate_from_api();
}