WooCommerce Code Reference

ProductFormTemplateInterface extends BlockTemplateInterface

Interface for block containers.

Table of Contents

add_group()  : GroupInterface
Adds a new group block.
generate_block_id()  : string
Generate a block ID based on a base.
get_area()  : string
Get the template area.
get_block()  : BlockInterface|null
Get a block by ID.
get_block_by_id()  : BlockInterface|null
Gets Block by id.
get_description()  : string
Get the template description.
get_formatted_template()  : array<string|int, mixed>
Get the block configuration as a formatted template.
get_group_by_id()  : GroupInterface|null
Gets Group block by id.
get_id()  : string
Get the template ID.
get_root_template()  : BlockTemplateInterface
Get the root template that the block belongs to.
get_section_by_id()  : SectionInterface|null
Gets Section block by id.
get_subsection_by_id()  : SubsectionInterface|null
Gets subsection block by id.
get_title()  : string
Get the template title.
remove_block()  : mixed
Removes a block from the container.
remove_blocks()  : mixed
Removes all blocks from the container.
to_json()  : array<string|int, mixed>
Get the template as JSON like array.

Methods

generate_block_id()

Generate a block ID based on a base.

public generate_block_id(string $id_base) : string
Parameters
$id_base : string

The base to use when generating an ID.

Return values
string

remove_block()

Removes a block from the container.

public remove_block(string $block_id) : mixed
Parameters
$block_id : string

The block ID.

Tags
throws
UnexpectedValueException

If the block container is not an ancestor of the block.

Return values
mixed