[wp-trac] [WordPress Trac] #59338: Themes: Inject theme attribute during block serialization

WordPress Trac noreply at wordpress.org
Thu Sep 14 08:50:58 UTC 2023


#59338: Themes: Inject theme attribute during block serialization
-----------------------------+------------------------------
 Reporter:  Bernhard Reiter  |       Owner:  Bernhard Reiter
     Type:  enhancement      |      Status:  closed
 Priority:  normal           |   Milestone:  6.4
Component:  Themes           |     Version:
 Severity:  normal           |  Resolution:  fixed
 Keywords:                   |     Focuses:
-----------------------------+------------------------------
Changes (by Bernhard Reiter):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 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/59338#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list