Automattic\WooCommerce\Blocks\Templates

ArchiveProductTemplatesCompatibility::set_hook_data()protectedWC 1.0

The hook data to inject to the rendered content of blocks. This also contains hooked functions that will be removed by remove_default_hooks.

The array format: [ <hook-name> => [

block_name => <block-name>,
position => before|after,
hooked => [
  <function-name> => <priority>,
   ...
],

], ] Where:

  • hook-name is the name of the hook that will be replaced.
  • block-name is the name of the block that will replace the hook.
  • position is the position of the block relative to the hook.
  • hooked is an array of functions hooked to the hook that will be replaced. The key is the function name and the value is the priority.

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

Хуков нет.

Возвращает

null. Ничего.

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

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

Код ArchiveProductTemplatesCompatibility::set_hook_data() WC 7.7.2

protected function set_hook_data() {
	$this->hook_data = array(
		'woocommerce_before_main_content'         => array(
			'block_name' => 'core/query',
			'position'   => 'before',
			'hooked'     => array(
				'woocommerce_output_content_wrapper' => 10,
				'woocommerce_breadcrumb'             => 20,
			),
		),
		'woocommerce_after_main_content'          => array(
			'block_name' => 'core/query',
			'position'   => 'after',
			'hooked'     => array(
				'woocommerce_output_content_wrapper_end' => 10,
			),
		),
		'woocommerce_before_shop_loop_item_title' => array(
			'block_name' => 'core/post-title',
			'position'   => 'before',
			'hooked'     => array(
				'woocommerce_show_product_loop_sale_flash' => 10,
				'woocommerce_template_loop_product_thumbnail' => 10,
			),
		),
		'woocommerce_shop_loop_item_title'        => array(
			'block_name' => 'core/post-title',
			'position'   => 'after',
			'hooked'     => array(
				'woocommerce_template_loop_product_title' => 10,
			),
		),
		'woocommerce_after_shop_loop_item_title'  => array(
			'block_name' => 'core/post-title',
			'position'   => 'after',
			'hooked'     => array(
				'woocommerce_template_loop_rating' => 5,
				'woocommerce_template_loop_price'  => 10,
			),
		),
		'woocommerce_before_shop_loop_item'       => array(
			'block_name' => self::LOOP_ITEM_ID,
			'position'   => 'before',
			'hooked'     => array(
				'woocommerce_template_loop_product_link_open' => 10,
			),
		),
		'woocommerce_after_shop_loop_item'        => array(
			'block_name' => self::LOOP_ITEM_ID,
			'position'   => 'after',
			'hooked'     => array(
				'woocommerce_template_loop_product_link_close' => 5,
				'woocommerce_template_loop_add_to_cart' => 10,
			),
		),
		'woocommerce_before_shop_loop'            => array(
			'block_name' => 'core/post-template',
			'position'   => 'before',
			'hooked'     => array(
				'woocommerce_output_all_notices' => 10,
				'woocommerce_result_count'       => 20,
				'woocommerce_catalog_ordering'   => 30,
			),
		),
		'woocommerce_after_shop_loop'             => array(
			'block_name' => 'core/post-template',
			'position'   => 'after',
			'hooked'     => array(
				'woocommerce_pagination' => 10,
			),
		),
		'woocommerce_no_products_found'           => array(
			'block_name' => 'core/query-no-results',
			'position'   => 'before',
			'hooked'     => array(
				'wc_no_products_found' => 10,
			),
		),
		'woocommerce_archive_description'         => array(
			'block_name' => 'core/term-description',
			'position'   => 'before',
			'hooked'     => array(
				'woocommerce_taxonomy_archive_description' => 10,
				'woocommerce_product_archive_description'  => 10,
			),
		),
	);
}