Make WordPress Core


Ignore:
Timestamp:
09/14/2023 08:50:43 AM (21 months ago)
Author:
Bernhard Reiter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.