[wp-trac] [WordPress Trac] #60696: Block hooks: Allow insertion of a hooked block with attributes
WordPress Trac
noreply at wordpress.org
Tue Mar 5 21:07:33 UTC 2024
#60696: Block hooks: Allow insertion of a hooked block with attributes
-------------------------+-----------------------------
Reporter: joshuaflow | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Previously, the `hooked_block_types` and
`hooked_block_{$hooked_block_type}` filters were introduced to allow
templates to be extended with blocks by third parties.
While those two filters work well with unique blocks, they prove
challenging when working with generic blocks that can be customized via
attributes. Attempting to hook a block into an area that has already
inserted the same block type, but with different attributes won't work
with the existing filters.
[This PR](https://github.com/woocommerce/woocommerce/pull/44860)
demonstrates how attempting to set attributes via the
`hooked_block_{$hooked_block_type}` filter will overwrite all of the same
block types that have been hooked in.
It may be possible that block hooks aren't the appropriate venue for this
API, but a way to insert blocks with attributes into templates is quite
useful, even in the context of the core editor.
**Requirements:
**
* [ ] Allow insertion of blocks with block attributes in a single filter
* [ ] Allow checking anchor block properties before inserting hooked
blocks
* [ ] (optional, but preferred) Allow nesting hooked blocks onto previous
hooked blocks
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60696>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list