Use a Template Part in a Pattern without including a theme
attribute.
#53194
Labels
[Feature] Patterns
A collection of blocks that can be synced (previously reusable blocks) or unsynced
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
When a template (or template part) includes a template part in the markup the
theme
attribute can be left out. I believe that means that "this theme" is assumed.When building themes it seems to be necessary to make sure that the attribute is NOT present since the full location of the theme has to be included. (For example if a theme is installed in a folder
/themes/pub/my-theme
the attribute MUST bepub/my-theme
, if instead it ismy-theme
or anything else the template part referenced won't be found).However when a theme includes a PATTERN and the PATTERN references a template-part in that theme the template part will ONLY be rendered if the
theme
attribute is included. And since it has been established that when building a theme thetheme
attribute must be excluded the result is that a PATTERN included in the theme CANNOT include any template parts.This is only important in some situations where a pattern has to be used for the content of a template (so that the content can be localized or can reference images included in the theme) and also must include assets such as a header template-part. Work-arounds include ensuring that patterns ONLY include references to other patterns and making sure that templates can achieve their layouts in ways that don't require those references to be made in their content.
What is your proposed solution?
When a template part is loaded from a pattern the
theme
is assumed to bethis theme
just as it is when loaded from a template.The text was updated successfully, but these errors were encountered: