Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pbking opened this issue Jul 31, 2023 · 3 comments · Fixed by #53423
Closed

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

pbking opened this issue Jul 31, 2023 · 3 comments · Fixed by #53423
Assignees
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.

Comments

@pbking
Copy link
Contributor

pbking commented Jul 31, 2023

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.

@scruffian
Copy link
Contributor

This still seems to be an issue when using a pattern inside another pattern, so I'm going to reopen it...

@scruffian
Copy link
Contributor

I have another fix here: #54595

@scruffian
Copy link
Contributor

I think this can be closed again since #54595 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants