Automattic\WooCommerce\Blocks\BlockTypes

ProductQuery::initialize()protectedWC 1.0

Initialize this block type.

  • Hook into WP lifecycle.
  • Register the block with WordPress.
  • Hook into pre_render_block to update the query.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->initialize();

Код ProductQuery::initialize() WC 9.1.2

protected function initialize() {
	add_filter( 'query_vars', array( $this, 'set_query_vars' ) );
	parent::initialize();
	add_filter(
		'pre_render_block',
		array( $this, 'update_query' ),
		10,
		2
	);
	add_filter(
		'render_block',
		array( $this, 'enqueue_styles' ),
		10,
		2
	);
	add_filter( 'rest_product_query', array( $this, 'update_rest_query' ), 10, 2 );
	add_filter( 'rest_product_collection_params', array( $this, 'extend_rest_query_allowed_params' ), 10, 1 );
}