No link template 'canonical' found entity type

Created on 3 December 2022, almost 2 years ago
Updated 22 February 2023, almost 2 years ago

Problem/Motivation

Smart read more field formatter should not be available if entity does have canonical link template.

Steps to reproduce

Enable module.
Create one paragraph
Create field which supports ckeditor
Go to manage display and choose smart read more formatter.
Create paragraph field in article content
Now create content with paragraph data.

You will see below error.

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).

Proposed resolution

Define isApplicable method inside field formatter and check entity type has canonical link or not.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India iyyappan.govind Chennai, India

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024