[wp-trac] [WordPress Trac] #59572: Block Hooks: Allow passing block definitions
WordPress Trac
noreply at wordpress.org
Mon Oct 9 14:57:26 UTC 2023
#59572: Block Hooks: Allow passing block definitions
-----------------------------+------------------------------
Reporter: Bernhard Reiter | Owner: Bernhard Reiter
Type: enhancement | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Description changed by Bernhard Reiter:
Old description:
> Currently, it is only possible to specify a block name for automatic
> insertion via Block Hooks; this means the block will be inserted in its
> "default" state (i.e. with no way of specifying custom attributes or
> inner blocks). This is true for both registering a hooked block via the
> `blockHooks` field `block.json`, or via the `hooked_block_types` filter
> (introduced in [56673]).
>
> We might want to allow providing a full, parsed-block style, block
> definition:
>
> {{{#!php
> array( 'mycommerce/mini-cart', array(
> 'isPreview' => true,
> 'miniCartIcon' => 'bag',
> ) )
> }}}
>
>
> Props @ndiego for pointing out this shortcoming to me.
New description:
Currently, it is only possible to specify a block name for automatic
insertion via Block Hooks; this means the block will be inserted in its
"default" state (i.e. with no way of specifying custom attributes or inner
blocks). This is true for both registering a hooked block via the
`blockHooks` field `block.json`, or via the `hooked_block_types` filter
(introduced in [56673]).
We might want to allow providing a full, parsed-block style, block
definition, at least for the filter:
{{{#!php
array( 'mycommerce/mini-cart', array(
'isPreview' => true,
'miniCartIcon' => 'bag',
) )
}}}
Props @ndiego for pointing out this shortcoming to me.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59572#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list