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

Command icon 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

fb-multimedia created an issue. See original summary.

fboulanger’s picture

Title: Doesn't detect other theme pattern (except from the basetheme) » Doesn't detect all theme patterns (except from the basetheme)
Assigned: fboulanger » Unassigned
fboulanger’s picture

Title: Doesn't detect all theme patterns (except from the basetheme) » Doesn't detect other activated theme patterns (only from the basetheme)
Issue summary: View changes
fboulanger’s picture

Issue summary: View changes
fboulanger’s picture

Title: Doesn't detect other activated theme patterns (only from the basetheme) » Patterns library doesn't detect other activated theme patterns (only from the basetheme)
Issue summary: View changes
aneek’s picture

I am facing this issue too.

aneek’s picture

Assigned: Unassigned » aneek

aneek’s picture

Assigned: aneek » Unassigned
Status: Active » Needs review

The issue is, when the dynamic themes are loaded with there templates in ui_patterns_theme function, 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.php is 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.

sharique’s picture

Status: Needs review » Needs work

I'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.

sharique’s picture

Status: Needs work » Reviewed & tested by the community

I tested this patch in couple of scenarios, it is working fine.

very_random_man’s picture

I 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.

adriancid’s picture

I 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.

raywalters’s picture

I 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.

pdureau’s picture

Status: Reviewed & tested by the community » Postponed
sharique’s picture

I 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.

pdureau’s picture

Status: Postponed » Needs work