No link template 'canonical' found for the %entityType

Created on 30 October 2023, about 1 year ago

Problem/Motivation

Some entities doesn't have an entity page (canonical).

I got en error:
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).

Steps to reproduce

Create a view to show submission field "Submitted to:".
Source entity should not have a "canonical" entity page, like Paragraph entity.
https://www.drupal.org/project/paragraphs/issues/3238515#comment-15295491 πŸ’¬ No link template 'canonical' found for the 'paragraph' entity type Fixed

Proposed resolution

We should check source entity like

$source_entity->hasLinkTemplate('canonical')

before call

$source_entity->toLink()

in the WebformSubmissionSubmittedToLabel.php

πŸ› Bug report
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Dishvola

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

Comments & Activities

  • Issue created by @Dishvola
  • @dishvola opened merge request.
Production build 0.71.5 2024