Closed (fixed)
Project:
Bootstrap
Version:
8.x-3.x-dev
Component:
Theme Registry
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Mar 2018 at 15:19 UTC
Updated:
21 Jan 2019 at 20:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
eelkeblokHere's a very naive patch; simply scan the entire theme instead of just the templates directory.
Comment #3
markhalliwellThis issue doesn't sense to me.
I think you misunderstand how that module operates and what it does.
Component Libraries merely registers additional Twig namespaces.
The reason the theme registry specifically only looks at
templatesbecause that is where templates that follow core's theme hook naming patterns should live.That has nothing to do with component libraries.
If you custom component library twig templates aren't being discovered because they live outside
templates, then you should define the path to where they live in your theme's.info.ymlfile as described on the project page.Comment #4
eelkeblokThanks for the reply. I think I do understand how that module operates and I've done all that. The problem happens because I override a template that is also overridden by the Bootstrap theme. However, the template, in my subtheme, lives in a different directory. When debugging the alter code, what I see is that my template is found correctly and the path is correct, right up until the point the alter code in Bootstrap is ran. At that point, for each theme hook the code for some reason does a double check whether the template exists and overwrites the template path. Because it only scans in the templates subdirectory of a theme, it doesn't find the template for my subtheme and ends up overwriting the template path with the location from Bootstrap itself.
I can verify Bootstrap to be the cause by removing Bootstrap as the base theme from my subtheme. Obviously styling is al screwed up, but I can see that my template is used then.
Comment #6
markhalliwellAgain, this isn’t a bug.
If you’re overriding a template from the base theme, then that is a theme system template, not a component library template.
It should live in the same place as it does in the base theme, if only for continuity.
Comment #7
eelkeblokI see your point. It makes for a confusing experience, though, that it works fine with just core and components, but it breaks with this base theme.
Comment #8
markhalliwellSo this appears to be a (relatively) recent core change that only applies to sites running 8.4.0+.
What's confusing is that there wasn't a change record for this. I've now remedied this.
Comment #9
markhalliwellAlso, the above patch is reversed.
Comment #10
markhalliwellComment #12
markhalliwellComment #13
eelkeblokYeah, I figured the patch was probably reversed when it failed to apply, but did not look into it yet. Thanks for figuring this out.
Comment #15
markhalliwellAfter I made my initial investigation, #2821420-11: drupal_find_theme_templates() searches candidates that are never have templates and are duplicates I'm re-evaluating this issue.
I don't think core actually does what I thought it did after all.
As you can see here, the registry still defaults to the
/templatesdirectory of a theme:http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Theme/Regist...
This issue/commit should probably be reverted.
Comment #16
markhalliwellThe above patch/commit hasn't seemed to do any long-lasting damage, so I'm just going to close this.
Comment #17
markhalliwell