Automattic\WooCommerce\Blocks

BlockTypesController::init()protectedWC 1.0

Initialize class features.

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

Хуков нет.

Возвращает

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

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

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

Код BlockTypesController::init() WC 8.7.0

protected function init() {
	add_action( 'init', array( $this, 'register_blocks' ) );
	add_filter( 'render_block', array( $this, 'add_data_attributes' ), 10, 2 );
	add_action( 'woocommerce_login_form_end', array( $this, 'redirect_to_field' ) );
	add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_legacy_widgets_with_block_equivalent' ) );
	add_action( 'woocommerce_delete_product_transients', array( $this, 'delete_product_transients' ) );
	add_filter(
		'woocommerce_is_checkout',
		function( $return ) {
			return $return || $this->has_block_variation( 'woocommerce/classic-shortcode', 'shortcode', 'checkout' );
		}
	);
	add_filter(
		'woocommerce_is_cart',
		function( $return ) {
			return $return || $this->has_block_variation( 'woocommerce/classic-shortcode', 'shortcode', 'cart' );
		}
	);
}