- ๐บ๐ธUnited States JCL324 Portland, OR
Just got this too with Drupal 10 core, Paragraphs 8.x-1.15:
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'paragraph' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).
- ๐บ๐ธUnited States smethawee
I just got this too when I updated from Drupal 9.5.2 to Drupal 9.5.4 core, Paragraphs 8.x-1.15:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'paragraph' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).
How to solve this issue? I still got this.
- ๐บ๐ธUnited States Greg Boggs Portland Oregon
This patch works for us in D9.
- ๐จ๐ญSwitzerland berdir Switzerland
See #20 for example. You fix this error enabling verbose errors with backtrace, see who is incorrectly calling toUrl() on an entity without checking if it has a canonical link template. It might be comments, there is an issue referenced above, or another contrib or custom module.
- ๐ณ๐ฟNew Zealand Gold 20 minutes in the future
I'm seeing this on Paragraphs 1.15.
The site is a build with no custom code touching this area. The error is resolved with the rerolled patch at #17 is working for me. @akhilavnair, the only tweak I'd suggest is code standards on the comment.
Given there are many reports of this being resolved by fixing it in Paragraphs I'm unsure why this isn't just being resolved here.
It works. Using the patch at #17 with cwegans/composer-patches for now.
- ๐บ๐ฆUkraine Dishvola
In my case I need a view of the all webform submissions with a links to source entity and it's a paragraph for some cases... so the system can't to get it and I see a whitescreen.
- ๐ฌ๐งUnited Kingdom freelylw
got this problem again in my drupal 9, after upgrade the core to 10, the problem stay exist
https://www.drupal.org/project/paragraphs/issues/3404000 ๐ The website encountered an unexpected error. ( problem with layout builder ) Active
- First commit to issue fork.
- ๐จ๐ฆCanada Liam Morland Ontario, CA ๐จ๐ฆ
Liam Morland โ made their first commit to this issueโs fork.
- ๐บ๐ธUnited States andysipple
#17 was no longer applying for me.
Reroll #17 - ๐ณ๐ฟNew Zealand Gold 20 minutes in the future
Rerolled patch at #35 applies and still works as expected.
Cheers @andysipple.
- ๐ช๐จEcuador jwilson3
Patch in #35 did not work for my case, so I've followed the directions in #14 and filed an issue in the contrib module I'm using to better support Paragraphs by testing whether entities implement a canonical link template before calling
toUrl()
๐ Support entity types that don't have link templates (like Paragraphs) Active
- ๐บ๐ธUnited States socketwench
I was able to replicate this using paragraphs and core alone.
In our case, we had an image field on a paragraph. The image field was configured to link to content. In `core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php`, that resolves to:
if ($image_link_setting == 'content') { $entity = $items->getEntity(); if (!$entity->isNew()) { $url = $entity->toUrl();
Since the paragraph is the parent entity in this case, core gets the paragraph, then attempts to generate the default link template, causing the error.
Removing the link to content resolves the error, but this is a workaround. The proper solution is that either core has to cross check that the default link template is available, or Paragraphs needs to provide it in all cases, even if it links to nothing.
- ๐ช๐จEcuador jwilson3
Since Paragraphs ultimately have to be "attached" to some entity, perhaps there is a way that the canonical link implementation could dynamically recurse up the entity reference tree using Paragraphs::getParentEntity() until it finds the first parent entity that has a canonical link and return that?
- ๐บ๐ฆUkraine sanyok_medved
This issue is reproduced when I have Paragraph as Reference inside Paragraph. It looks up for. parent link "canonical" but paragraph doesn't have canonical. I've attached patch for this. It is in ImageFormatter field. When you use Image in Paragraph and have link to parent.
- ๐ช๐จEcuador jwilson3
Since the patch in Comment #40 is for Drupal core, I suggest creating a Drupal core issue if for no other reason than to see what core maintainers have to say about this issue.