Crashes on config entities that define a canonical link template

Created on 23 April 2025, 1 day ago

Problem/Motivation

A lot of contrib config entities define a canonical link template but not a view builder, e.g. in Entity Share:

 *   links = {
 *     "canonical" = "/admin/config/services/entity_share/channel/{channel}",

This means that this code in Responsive Preview crashes:

      if ($entity->hasLinkTemplate('canonical')) {
        return $entity->toUrl()->toString();
      }

Steps to reproduce

Install a module such as Entity Share and try edit a channel config entity.

Proposed resolution

1. Don't act on config entities
2. Move the check for admin routes to the top of the method, as there's no point doing anything on admin routes

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.2

Component

Code

Created by

🇬🇧United Kingdom joachim

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

Comments & Activities

Production build 0.71.5 2024