Automattic\WooCommerce\Blocks\BlockTypes
ProductQuery::enqueue_data
Extra data passed through from server to client for block.
Метод класса: ProductQuery{}
Хуки из метода
Возвращает
null. Ничего (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.
По умолчанию:[]
Код ProductQuery::enqueue_data() ProductQuery::enqueue data WC 11.2.1
protected function enqueue_data( array $attributes = [] ) {
parent::enqueue_data( $attributes );
$post_template_has_support_for_grid_view = $this->check_if_post_template_has_support_for_grid_view();
$this->asset_data_registry->add(
'postTemplateHasSupportForGridView',
$post_template_has_support_for_grid_view
);
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment -- Documented in WC_Query::product_query().
$this->asset_data_registry->add( 'loopShopPerPage', apply_filters( 'loop_shop_per_page', wc_get_default_products_per_row() * wc_get_default_product_rows_per_page() ) );
}