[wp-trac] [WordPress Trac] #59313: Implement Block Hooks
WordPress Trac
noreply at wordpress.org
Thu Sep 14 08:50:58 UTC 2023
#59313: Implement Block Hooks
-------------------------------------------------+-------------------------
Reporter: Bernhard Reiter | Owner: Bernhard
| Reiter
Type: enhancement | Status: assigned
Priority: high | Milestone: 6.4
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: has-patch gutenberg-merge has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by Bernhard Reiter):
In [changeset:"56578" 56578]:
{{{
#!CommitTicketReference repository="" revision="56578"
Themes: Inject `theme` attribute during serialization.
Rather than using `_inject_theme_attribute_in_block_template_content` to
inject the `theme` attribute into all Template Part blocks found in a
given file-based Block Template, introduce a new function called
`_inject_theme_attribute_in_template_part_block`, and use that as second
argument to `serialize_blocks()` (introduced in [56557]) in order to
inject said attribute during tree traversal for serialization.
This allows for a more modular approach that will eventually be extended
to implement automatic insertion of hooked blocks.
Note that we're guarding `_build_block_template_result_from_file()` (i.e.
the callsite of `_inject_theme_attribute_in_template_part_block` and
previously of `_inject_theme_attribute_in_block_template_content`) against
regressions through additional unit test coverage added in [56562].
Props @gziolo.
Fixes #59338. See #59313.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59313#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list