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 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' );
		}
	);
}