Skip to content

Use a Template Part in a Pattern without including a theme attribute. #53194

@pbking

Description

@pbking

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 be pub/my-theme, if instead it is my-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 the theme 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 be this theme just as it is when loaded from a template.

Metadata

Metadata

Assignees

Labels

[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions