BlockContainerInterface
extends
BlockInterface, ContainerInterface
in
Interface for block containers.
Table of Contents
- ATTRIBUTES_KEY = 'attributes'
- Key for the block attributes in the block configuration.
- DISABLE_CONDITIONS_KEY = 'disableConditions'
- Key for the block disable conditions in the block configuration.
- HIDE_CONDITIONS_KEY = 'hideConditions'
- Key for the block hide conditions in the block configuration.
- ID_KEY = 'id'
- Key for the block ID in the block configuration.
- NAME_KEY = 'blockName'
- Key for the block name in the block configuration.
- ORDER_KEY = 'order'
- Key for the internal order in the block configuration.
- add_disable_condition() : string
- Add a disable condition to the block.
- add_hide_condition() : string
- Add a hide condition to the block.
- get_attributes() : array<string|int, mixed>
- Get the block attributes.
- get_block() : BlockInterface|null
- Get a block by ID.
- get_disable_conditions() : array<string|int, mixed>
- Get the disable conditions of the block.
- get_formatted_template() : array<string|int, mixed>
- Get the block configuration as a formatted template.
- get_hide_conditions() : array<string|int, mixed>
- Get the hide conditions of the block.
- get_id() : string
- Get the block ID.
- get_name() : string
- Get the block name.
- get_order() : int
- Get the block order.
- get_parent() : ContainerInterface
- Get the parent container that the block belongs to.
- get_root_template() : BlockTemplateInterface
- Get the root template that the block belongs to.
- is_detached() : bool
- Check if the block is detached from its parent or root template.
- remove() : mixed
- Remove the block from its parent.
- remove_block() : mixed
- Removes a block from the container.
- remove_blocks() : mixed
- Removes all blocks from the container.
- remove_disable_condition() : mixed
- Remove a disable condition from the block.
- remove_hide_condition() : mixed
- Remove a hide condition from the block.
- set_attribute() : mixed
- Set a block attribute value without replacing the entire attributes object.
- set_attributes() : mixed
- Set the block attributes.
- set_order() : mixed
- Set the block order.
Constants
ATTRIBUTES_KEY
Key for the block attributes in the block configuration.
public
mixed
ATTRIBUTES_KEY
= 'attributes'
DISABLE_CONDITIONS_KEY
Key for the block disable conditions in the block configuration.
public
mixed
DISABLE_CONDITIONS_KEY
= 'disableConditions'
HIDE_CONDITIONS_KEY
Key for the block hide conditions in the block configuration.
public
mixed
HIDE_CONDITIONS_KEY
= 'hideConditions'
ID_KEY
Key for the block ID in the block configuration.
public
mixed
ID_KEY
= 'id'
NAME_KEY
Key for the block name in the block configuration.
public
mixed
NAME_KEY
= 'blockName'
ORDER_KEY
Key for the internal order in the block configuration.
public
mixed
ORDER_KEY
= 'order'
Methods
add_disable_condition()
Add a disable condition to the block.
public
add_disable_condition(string $expression) : string
The disable condition is a JavaScript-like expression that will be evaluated on the client to determine if the block should be disabled. See @woocommerce/expression-evaluation for more details.
Parameters
- $expression : string
-
An expression, which if true, will disable the block.
Return values
string — The key of the disable condition, which can be used to remove the disable condition.add_hide_condition()
Add a hide condition to the block.
public
add_hide_condition(string $expression) : string
The hide condition is a JavaScript-like expression that will be evaluated on the client to determine if the block should be hidden. See @woocommerce/expression-evaluation for more details.
Parameters
- $expression : string
-
An expression, which if true, will hide the block.
Return values
string — The key of the hide condition, which can be used to remove the hide condition.get_attributes()
Get the block attributes.
public
get_attributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_block()
Get a block by ID.
public
get_block(string $block_id) : BlockInterface|null
Parameters
- $block_id : string
-
The block ID.
Return values
BlockInterface|null —get_disable_conditions()
Get the disable conditions of the block.
public
get_disable_conditions() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_formatted_template()
Get the block configuration as a formatted template.
public
get_formatted_template() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_hide_conditions()
Get the hide conditions of the block.
public
get_hide_conditions() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_id()
Get the block ID.
public
get_id() : string
Return values
string —get_name()
Get the block name.
public
get_name() : string
Return values
string —get_order()
Get the block order.
public
get_order() : int
Return values
int —get_parent()
Get the parent container that the block belongs to.
public
get_parent() : ContainerInterface
Return values
ContainerInterface —get_root_template()
Get the root template that the block belongs to.
public
get_root_template() : BlockTemplateInterface
Return values
BlockTemplateInterface —is_detached()
Check if the block is detached from its parent or root template.
public
is_detached() : bool
Return values
bool — True if the block is detached from its parent or root template.remove()
Remove the block from its parent.
public
remove() : mixed
Return values
mixed —remove_block()
Removes a block from the container.
public
remove_block(string $block_id) : mixed
Parameters
- $block_id : string
-
The block ID.
Tags
Return values
mixed —remove_blocks()
Removes all blocks from the container.
public
remove_blocks() : mixed
Return values
mixed —remove_disable_condition()
Remove a disable condition from the block.
public
remove_disable_condition(string $key) : mixed
Parameters
- $key : string
-
The key of the disable condition to remove.
Return values
mixed —remove_hide_condition()
Remove a hide condition from the block.
public
remove_hide_condition(string $key) : mixed
Parameters
- $key : string
-
The key of the hide condition to remove.
Return values
mixed —set_attribute()
Set a block attribute value without replacing the entire attributes object.
public
set_attribute(string $key, mixed $value) : mixed
Parameters
- $key : string
-
The attribute key.
- $value : mixed
-
The attribute value.
Return values
mixed —set_attributes()
Set the block attributes.
public
set_attributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
-
The block attributes.
Return values
mixed —set_order()
Set the block order.
public
set_order(int $order) : mixed
Parameters
- $order : int
-
The block order.