Automattic\WooCommerce\Blocks\BlockTypes

AbstractBlock::initialize()protectedWC 1.0

Initialize this block type.

  • Hook into WP lifecycle.
  • Register the block with WordPress.

Method of the class: AbstractBlock{}

No Hooks.

Return

null. Nothing (null).

Usage

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

AbstractBlock::initialize() code WC 9.4.2

protected function initialize() {
	if ( empty( $this->block_name ) ) {
		_doing_it_wrong( __METHOD__, esc_html__( 'Block name is required.', 'woocommerce' ), '4.5.0' );
		return false;
	}
	$this->integration_registry->initialize( $this->block_name . '_block' );
	$this->register_block_type_assets();
	$this->register_block_type();
	add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_editor_assets' ] );
}