Make WordPress Core

Opened 8 weeks ago

#60854 new enhancement

Block Hooks: Allow insertion as first or last child of Template Part block

Reported by: bernhard-reiter's profile Bernhard Reiter Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

In GB#57754, a mechanism was introduced to allow insertion of hooked blocks into the Navigation block, in particular as its first_child or last_child, thus fixing #59743. The latter was achieved by storing the ignoredHookedBlocks array in the corresponding wp_navigation post's post meta (instead of a metadata attribute on the anchor block).

This technique could be applied to other blocks that fetch their inner blocks from a separate DB record (rather than having them stored inline); these are sometimes referred to as "controlled inner blocks".

There might not be a large number of container blocks with controlled inner blocks into which we'd want to inject hooked blocks; however, there's at least one obvious example: The Template Part block. It's currently not possible to inject a hooked block as its first or last child.

Note however that the code that inserts hooked blocks into the Navigation block's wp_navigation post objects currently lives in Gutenberg. Consequently, it's advisable to absorb that code into Core first (i.e. to fix #60759) before tackling this issue.

Change History (0)

Note: See TracTickets for help on using tickets.