[wp-trac] [WordPress Trac] #59882: Expose serialized template content to callbacks registered to the `hooked_block_types` filter.

WordPress Trac noreply at wordpress.org
Fri Nov 10 19:18:35 UTC 2023


#59882: Expose serialized template content to callbacks registered to the
`hooked_block_types` filter.
-------------------------+-----------------------------
 Reporter:  nerrad       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Editor       |    Version:
 Severity:  normal       |   Keywords:  needs-patch
  Focuses:  template     |
-------------------------+-----------------------------
 The recently introduced Block Hooks API exposes a filter
 (`hooked_block_types`) which exposes `$context` as an argument. When a
 [https://github.com/WordPress/wordpress-
 develop/blob/9df9e28f65fb5da8b65e08e3aeceed061f18638d/src/wp-includes
 /block-template-utils.php#L519 template file is built],
 `WP_Block_Template::content` [https://github.com/WordPress/wordpress-
 develop/blob/9df9e28f65fb5da8b65e08e3aeceed061f18638d/src/wp-includes
 /block-template-utils.php#L558 is not exposed] to the callbacks registered
 on `hooked_block_types`.

 This would be useful for callbacks that might want to detect the presence
 of a serialized block instance (or potentially in the future utilize the
 HTML API) to restrict where the block is injected (before the template is
 rendered).

 Addressing this would also achieve parity with the structure of `$context`
 when it represents a pattern (where pattern serialized content is
 present).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59882>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list