Exception thrown when editing a finder

Created on 11 January 2025, 3 months ago

When editing a finder entity, with the responsive_preview module installed, I get an exception thrown:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.finder.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 208 of core/lib/Drupal/Core/Routing/RouteProvider.php).

This is caused by these lines in responsive_preview:

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

The Finder entity declares a canonical link, but doesn't declare a view_builder handler. The lack of view_builder causes \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getCanonicalRoute() to not add the canonical route to the routing, and hence we get the exception thrown.

Taking out the canonical link template from the entity annotation fixes this.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom rupertj Bristol, UK

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024