Patterns provider is always set to the base_plugin_definition provider

Created on 8 February 2024, 9 months ago
Updated 2 March 2024, 9 months ago

Problem/Motivation

When using ui_patterns_library to find patterns defined in another module using the file module.patterns.yml the templates are not found when rendering since the provider is set to ui_patterns_library instead of the module providing the module.patterns.yml file.

Steps to reproduce

  1. Create a custom module providing at least one pattern in the file module.patterns.yml
  2. Enable the ui_patterns_library module
  3. Notice that the site throws the error Twig\Error\LoaderError: Template "modules/contrib/ui_patterns/modules/ui_patterns_library/templates/pattern-template-name.html.twig" is not defined when rendering the pattern

Proposed resolution

Use the provider set by the pattern if ine exists and fall back to using the base plugin proivider.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden auth

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @auth
  • Status changed to Needs review 9 months ago
  • πŸ‡ΈπŸ‡ͺSweden auth

    Attached is a patch impolementing the proposed resolution

  • πŸ‡ΈπŸ‡ͺSweden auth
  • πŸ‡³πŸ‡ΏNew Zealand andyd328 Lyttelton, NZ πŸ‡³πŸ‡Ώ

    The patch work for me. Many thanks auth.

    Changing to major as it really is important to pick up custom patterns, borderline critical as it breaks the parts of a site without this patch.

  • πŸ‡«πŸ‡·France pdureau Paris

    Hello guys,

    Thanks for your contribution. The issue you met may be a side effect of πŸ› Fix views preview when pattern declared by ui_pattern_library in the front theme. Fixed

    I would not do the review myself, because this subject is a bit tricky to me. I am afraid if we fix one stuff here, we will have a side effect somewhere else.

    Is applying the patch on your project good enough for now?

  • πŸ‡ΊπŸ‡ΈUnited States robert dearmond

    I have been struggling with this same issue and finally found #2 patch works for me!

    My error was:
    Uncaught PHP Exception Twig\Error\LoaderError: "Template "modules/contrib/ui_patterns/modules/ui_patterns_library/templates/pattern-page-body.html.twig" is not defined." at /code/web/modules/contrib/ds/templates/ds-entity-view.html.twig line 10

Production build 0.71.5 2024