Hello,
I have in my Drupal log warning like below. I don't think it's something wrong. In my scenario it's perfectly valid to have same names in different folders. This message could be useful during development for some, but it's definitely wrong in production environment. It's possible to make it optionable?
Found multiple files for the "@page/styleguide.twig" template; it is recommended to only have one "styleguide.twig" file in the "page" namespace’s "themes/custom/proficio/static/templates/page" directory
Source: https://git.drupalcode.org/project/components/-/blob/3.x/src/Template/Co...
Thank you
| Comment | File | Size | Author |
|---|
Issue fork components-3299045
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 #3
immaculatexavier commentedAs previously stated, I created a patch with one file in the "page" namespace.
Comment #6
parisekAdded MR and disabled logging warning "Found multiple files for the", seems it's not wide issue, patch is enough :)
Comment #7
parisekComment #9
codebymikey commentedAttached a patch which allows sites to opt out of the warning using their settings.php file:
Or on the theme/module level:
This still requires tests to be implemented, but works for my use case without breaking existing installations.
So feedback is more than welcome on the current implementation.
Comment #10
john cook commentedI had problems applying the diff / patch using
cweagans/composer-patches, with a segment being rejected incomponents.info.yml. This was due to versioning information added by the packaging script on Drupal.org. I manually added the two line change before testing. I don't see this being a problem once the issue has been merged.I tested with just the patch to make sure that the duplicates are reported by default. As expected, the errors appeared in the watchdog log.
Then I tried again after adding
$settings['components_ignore_duplicate_templates'] = TRUE;to mysettings.php. After I cleared the cache and refreshed the same page, the errors are no longer logged.Moving to RTBC.
Comment #11
john cook commentedAs a side note, I noticed this bug because I have
/webas a symlink to/docrootafter changing host providers.Comment #12
acbramley commentedStill NW on tests
Comment #13
dpiTo me, it seems the log simply didn't receive a lot of scrutiny (none) when added in #3191392: Make subdirectory path optional when using @namespace/template syntax.
Perhaps instead, we should just remove the log.
All this configuration seems a bit much.
Comment #14
johnalbinAgreed.
But we should also prevent any duplicated twig file name from being referenced using the short form, e.g.Nevermind, that would be a breaking change.@page/styleguide.twigwon't work but@page/full-path-to-file/styleguide.twigwould.Comment #20
johnalbinComment #22
johnalbin