Automattic\WooCommerce\Blocks

BlockTypesController::init()protectedWC 1.0

Initialize class features.

Method of the class: BlockTypesController{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->init();

BlockTypesController::init() code WC 9.4.2

protected function init() {
	add_action( 'init', array( $this, 'register_blocks' ) );
	add_filter( 'block_categories_all', array( $this, 'register_block_categories' ), 10, 2 );
	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 ( $ret ) {
			return $ret || $this->has_block_variation( 'woocommerce/classic-shortcode', 'shortcode', 'checkout' );
		}
	);
	add_filter(
		'woocommerce_is_cart',
		function ( $ret ) {
			return $ret || $this->has_block_variation( 'woocommerce/classic-shortcode', 'shortcode', 'cart' );
		}
	);
}