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

Fixing theme bug where dir must exist in core + expanded "default" fallback #114

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

weaverryan
Copy link
Collaborator

Hiya!

I noticed two issues with the theming system:

  1. If you use $configuration->setTheme('my_theme');, Twig would ALWAYS try to look
    for a lib/Templates/my_theme directory (inside rst-parser itself), which would cause an exception. Setting themes was unusable.

  2. There are two reasons to put "override" templates inside a library that uses rst-parser:
    A) to override individual pieces (e.g. paragraph.html.twig)
    B) to override layout.html.twig for themeing

Previously, if you had 2 themes (theme_foo and theme_bar), each with their own layout.html.twig file, there was no place to put the overrides for part (A): the system would ONLY look inside the active theme directory for ALL overrides (so paragraph.html.twig would need to live in both directories, so that it was found when you switched).

There was already a "fallback" concept: look inside the user's "theme" directory, then fallback to the default directory in core. I expanded that to always look for the theme directory first, but then look for a directory called default in all template directories. This allows you to put all your "component" overrides in a default directory, then ONLY your layout.html.twig in the theme directory (though you could still override "components" there if you need to).

Test included and is BC... because themes weren't working properly yet :).

Cheers!

And also adding the "default" fallback mechanism everywhere.
@jwage jwage merged commit 1d0d1ac into doctrine:master Aug 26, 2019
@jwage jwage added this to the 1.0.0 milestone Aug 26, 2019
@jwage jwage added the Bug Something isn't working label Aug 26, 2019
@jwage jwage self-assigned this Aug 26, 2019
@greg0ire greg0ire modified the milestones: 1.0.0, 0.3.0 Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants