I use the Smart Trim formatter on a paragraphs field (https://drupal.org/project/paragraphs). The paragraph entity is used as field in a node content type.
The Smart Trim formatter tries to link to the paragraphs entity (where the field with the Smart Trim formatter is used). But in the paragraphs entity plugin definition there is no link information defined.
So I get the twig error:
Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'paragraph' entity type in Drupal\Core\Entity\Entity->toUrl() (line 214 of core/lib/Drupal/Core/Entity/Entity.php).
Drupal\smart_trim\Plugin\Field\FieldFormatter\SmartTrimFormatter->viewElements(Object, 'de') (Line: 80)
Drupal\Core\Field\FormatterBase->view(Object, NULL) (Line: 259)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 303)
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'preview') (Line: 246)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 203)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
.....| Comment | File | Size | Author |
|---|---|---|---|
| #8 | smart_trim_url_twig_exception-2736839-08.patch | 771 bytes | casey |
| #2 | smart_trim_url_twig_exception-2736839-01.patch | 757 bytes | cbeier |
Comments
Comment #2
cbeier commentedMy current solution / A solution for me is to check if a valid link template is available for the current entity.
Comment #3
maartendeblock commentedI've tested the patch on drupal 8.1.2 and it works.
Thank you.
Comment #5
markie commented@cbeier thanks for the patch. I have applied it to the dev branch. I did correct a formatting error, NULL needs to be capitalized to conform with Drupal standards. Thanks again for your contribution.
Comment #6
markie commentedComment #8
casey commentedAttaching patch so we can apply it to the stable release. Isn't it time for a new stable release?
Comment #9
anybodyWe've just run into this issue... there should be a new stable release ASAP please fixing this. Is there an active maintainer?