Problem/Motivation
Patterns from other themes (activated) are not availables in page library view.
gives this error at /patterns page :
'Twig\Error\LoaderError: Template "modules/contrib/ui_patterns/templates/pattern-alert.html.twig" is not defined. in Twig\Loader\ChainLoader->getCacheKey() (line 35 of modules/contrib/ui_patterns/modules/ui_patterns_library/templates/patterns-overview-page.html.twig).'
Steps to reproduce
Create theme with patterns and make it default.
Activate an other theme with patterns like UI Suite Bootstrap
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork ui_patterns-3335833
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fboulangerComment #3
fboulangerComment #4
fboulangerComment #5
fboulangerComment #6
aneek commentedI am facing this issue too.
Comment #7
aneek commentedComment #9
aneek commentedThe issue is, when the dynamic themes are loaded with there templates in
ui_patterns_themefunction, it was not generating the path for the template.The
protected function processCustomThemeHookProperty(PatternDefinition $definition){}inside./ui_patterns/modules/ui_patterns_library/src/Plugin/UiPatterns/Pattern/LibraryPattern.phpis actually checking for the themes and modules if any custom hooks are provided. I have changed the logic there to always scan for enabled modules and add the path to the template.Comment #10
sharique commentedI'm getting same error but my scenario is little different.
I've a paragraph type, with mapping to a pattern.
I'm using layout paragraph, so it show the preview in edit mode also.
In the node add/edit I'm getting same error "Template not defined." as these page uses admin theme and pattern in define in default theme.
Comment #11
sharique commentedI tested this patch in couple of scenarios, it is working fine.
Comment #12
very_random_man commentedI can confirm this is working for me too.
I was getting this error as the Views preview was attempting to render nodes where a pattern was applied in the content type field display settings but that pattern was defined in the front-end theme.
Comment #13
adriancidI can confirm the patch is working for the 1.5 version. I had the error after upgrade the module and now is working well with the patch.
Comment #14
raywalters commentedI needed to apply this patch along with the merge request diff from https://www.drupal.org/project/components/issues/3107993 for components to resolve the my error on the views admin page.
Comment #15
pdureau commentedOk, so let's wait #3107993: Template is not defined error on admin pages when using administration theme before merging
Comment #16
sharique commentedI performed a quick test this on UI pattern 2.0, and this is issue in not present in the v2.0.
I'll test with 1.x and post update.
Comment #17
pdureau commented