#59338 closed enhancement (fixed)
Themes: Inject theme attribute during block serialization
| Reported by: | Bernhard Reiter | Owned by: | Bernhard Reiter |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.4 |
| Component: | Themes | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
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 tentatively 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 (see #59313).
Change History (4)
#4
@
3 years ago
@gziolo @bernhard-reiter Just to double check whether that is correct, looking at https://github.com/WordPress/wordpress-develop/pull/5192#issuecomment-1719000338, it appears this change (plus the underlying function from #59327) is a quite notable performance improvement?
Curious whether that was an intended goal here, and I wonder if you have more context where the benefit could come from? Potentially the removed call to _flatten_blocks() is responsible for that? That function at least seems somewhat expensive to me.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 56578: