[wp-trac] [WordPress Trac] #60769: Block Hooks: Consolidate approach to get the list of hooked blocks.

WordPress Trac noreply at wordpress.org
Tue May 21 08:42:29 UTC 2024


#60769: Block Hooks: Consolidate approach to get the list of hooked blocks.
---------------------------+------------------------------
 Reporter:  tomjcafferkey  |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  General        |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+------------------------------

Comment (by tomjcafferkey):

 > Makes me wonder if we should introduce a separate helper function for
 this (since it seems like it would be different enough from
 get_hooked_blocks()). get_hooked_blocks_for_block_hook() or so maybe. (If
 we assume that a block hook is defined by an anchor block and a relative
 position.)

 This is the approach I was thinking of taking. If we were to modify
 `get_hooked_blocks()` we'd need to change both its signature and return
 value.

 We may also need to revisit the visitor functions and the callbacks they
 return since they all pass down `$hooked_blocks` which won't be necessary
 any longer if a new helper function will handle getting this value inside
 `insert_hooked_blocks` and `set_ignored_hooked_blocks_metadata`
 internally.

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


More information about the wp-trac mailing list