Automattic\WooCommerce\Internal\Features\ProductBlockEditor\ProductTemplates

AbstractProductFormTemplate::get_subsection_by_id()publicWC 1.0

Get a subsection block by ID.

Method of the class: AbstractProductFormTemplate{}

No Hooks.

Return

null. Nothing (null).

Usage

$AbstractProductFormTemplate = new AbstractProductFormTemplate();
$AbstractProductFormTemplate->get_subsection_by_id( $subsection_id ): ?SubsectionInterface;
$subsection_id(string) (required)
The subsection block ID.

AbstractProductFormTemplate::get_subsection_by_id() code WC 9.3.3

public function get_subsection_by_id( string $subsection_id ): ?SubsectionInterface {
	$subsection = $this->get_block( $subsection_id );
	if ( $subsection && ! $subsection instanceof SubsectionInterface ) {
		throw new \UnexpectedValueException( 'Block with specified ID is not a subsection.' );
	}
	return $subsection;
}