Automattic\WooCommerce\Blocks\BlockTypes

AbstractBlock::register_block_type()protectedWC 1.0

Registers the block type with WordPress.

{} Это метод класса: AbstractBlock{}

Хуков нет.

Возвращает

Строку[]. Chunks paths.

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

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

Код AbstractBlock::register_block_type() WC 6.9.4

protected function register_block_type() {
	$block_settings = [
		'render_callback' => $this->get_block_type_render_callback(),
		'editor_script'   => $this->get_block_type_editor_script( 'handle' ),
		'editor_style'    => $this->get_block_type_editor_style(),
		'style'           => $this->get_block_type_style(),
	];

	if ( isset( $this->api_version ) && '2' === $this->api_version ) {
		$block_settings['api_version'] = 2;
	}

	$metadata_path = $this->asset_api->get_block_metadata_path( $this->block_name );
	// Prefer to register with metadata if the path is set in the block's class.
	if ( ! empty( $metadata_path ) ) {
		register_block_type_from_metadata(
			$metadata_path,
			$block_settings
		);
		return;
	}

	/*
	 * Insert attributes and supports if we're not registering the block using metadata.
	 * These are left unset until now and only added here because if they were set when registering with metadata,
	 * the attributes and supports from $block_settings would override the values from metadata.
	 */
	$block_settings['attributes'] = $this->get_block_type_attributes();
	$block_settings['supports']   = $this->get_block_type_supports();

	register_block_type(
		$this->get_block_type(),
		$block_settings
	);
}