[wp-trac] [WordPress Trac] #59383: Blocks: Introduce helper function to retrieve hooked blocks

WordPress Trac noreply at wordpress.org
Mon Sep 25 11:05:06 UTC 2023


#59383: Blocks: Introduce helper function to retrieve hooked blocks
--------------------------------------+-----------------------
 Reporter:  gziolo                    |       Owner:  gziolo
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.4
Component:  Themes                    |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------

Comment (by gziolo):

 One alternative solution I was contemplating is to pass the structure for
 all hooked blocks to the callback that is called when serializing every
 block. Instead of computing it here:

 https://github.com/WordPress/wordpress-
 develop/blob/de9e06a4c021295af3ac11fdd08ea29a57529668/src/wp-
 includes/blocks.php#L807

 https://github.com/WordPress/wordpress-
 develop/blob/de9e06a4c021295af3ac11fdd08ea29a57529668/src/wp-
 includes/blocks.php#L827

 We could do it once for a template in:

 https://github.com/WordPress/wordpress-
 develop/blob/de9e06a4c021295af3ac11fdd08ea29a57529668/src/wp-includes
 /block-template-utils.php#L605-L606

 and once per pattern:

 https://github.com/WordPress/wordpress-
 develop/blob/de9e06a4c021295af3ac11fdd08ea29a57529668/src/wp-includes
 /class-wp-block-patterns-registry.php#L170-L171

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


More information about the wp-trac mailing list