Problem/Motivation
AH01071: Got error 'PHP message: Uncaught PHP Exception Twig\\Error\\LoaderError: "Template "@bootstrap_italia_paragraph/content/bi-paragraph-base.html.twig" is not defined in "themes/contrib/bootstrap_italia/modules/bootstrap_italia_paragraph/templates/paragraph--content--default.html.twig" at line 41." at /home/neb-chapter/drupal/vendor/twig/twig/src/Loader/ChainLoader.php line 99', referer: https://neb-chapter.eu/admin/content
Steps to reproduce
I installed the Theme on an existing drupal, following the installation procedure.
Proposed resolution
I corrected the the path to bi-paragraph-base.html.twig from
bootstrap_italia_paragraph/content/bi-paragraph-base.html.twig
to /bootstrap_italia_paragraph/templates/components/content/bi-paragraph-base.html.twig
in the file
themes/contrib/bootstrap_italia/modules/bootstrap_italia_paragraph/templates/paragraph--content--default.html.twig
After the correction the site was functional again.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| paragraph--content--default.html_.zip | 1.22 KB | starglide |
Comments
Comment #2
hritick commentedhey @starglide , kindly post issues in English so that everyone can understand and resolve this issue.
thanks and regards.
Comment #3
arturopanetta@starglide, @Hritick is right, on drupal.org they speak in English.
@alice, however you are right it's a bug. A bug with no negative effects though.
The bug is caused by this line of code: https://git.drupalcode.org/project/bootstrap_italia/-/blob/2.x/modules/b...
Drupal automatically creates a single twig namespace that points to the "templates" folder of each module or theme, for example the "@foo" twig namespace will point to the "foo/templates/" folder of the "foo" module.
In the specific case for the "bootstrap_italia_paragraph" module, drupal automatically builds a namespace "@bootstrap_italia_paragraph" which points to the "/themes/contrib/boostrap_italia/modules/bootstrap_italia_paragraph/templates" folder. But at the same time a new namespace is defined on line 16 of "bootstrap_italia_paragraph.info.yml" which overwrites the one automatically created by drupal.
Obviously my intentions when I wrote this piece of code were not to override the automatic namespace that drupal creates, so it's a bug.
I don't think the proposed solution is correct as the namespace is used in many other parts, so making the proposed change would break other parts of code.
Comment #4
starglide commentedComment #5
arturopanettaComment #6
arturopanettaComment #8
arturopanettaComment #10
arturopanetta