[wp-trac] [WordPress Trac] #59574: Blocks: No toggle shown for hooked blocks added via filter

WordPress Trac noreply at wordpress.org
Fri Feb 2 09:18:13 UTC 2024


#59574: Blocks: No toggle shown for hooked blocks added via filter
-----------------------------+------------------------------
 Reporter:  Bernhard Reiter  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by Bernhard Reiter):

 Replying to [comment:1 Bernhard Reiter]:
 > The best way I can think of to fix this would involve an entirely new
 endpoint (e.g. `block-hooks` or `hooked-blocks`) that receives pretty much
 the same information as the `hooked_block_types` filter.
 >
 > I.e. something like
 >
 >
 > {{{
 > /hooked-blocks/core/navigation?position=after&part=header
 > /hooked-blocks/core/comment-template?position=last-child&pattern=tt3
 /hidden-comments
 > }}}
 >
 > that should return the list of blocks hooked to that specific anchor
 block and in the position given by the eponymous query arg.

 Per https://github.com/WordPress/gutenberg/pull/57754, `wp_navigation`
 post objects can also be context. So we need to add something like

 > {{{
 > /hooked-blocks/core/page-list?position=after&navigation=4
 > }}}

 to the list.

 Pragmatically, we'd probably like to get a list of all anchor blocks that
 have hooked blocks when used in a given context, so we might want to
 support a syntax like

 {{{
 /hooked-blocks/?position=after&part=header
 /hooked-blocks/?position=last-child&pattern=tt3/hidden-comments
 }}}

 > (Some creative license taken here to allow for clients to have a
 pragmatic way of specifying context, see the `part` or `pattern` query
 args.)

 This is probably the trickiest part to figure out: How do we best allow
 clients to specify the `$context` as freely as possible?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59574#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list