Canonical Entity Link problems

Created on 5 January 2024, 12 months ago
Updated 16 August 2024, 4 months ago

Problem/Motivation

The entity definition links annotation lists a canonical link, but no such route exists leading to issues with other modules like responsive preview.

Steps to reproduce

Enable Block Visibility Groups and Responsive Preview.
Add a new Visibility Group
Attempt to Edit the Visibility group

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States emerham

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

Merge Requests

Comments & Activities

  • Issue created by @emerham
  • 🇺🇸United States emerham

    Example:

    The Module Responsive Preview checks if an entity has a canonical link and will then use that to build it's own URL for checking the page. This module's entity annotation defines that it should have a canonical url but that doesn't actually exist.

    The website encountered an unexpected error. Try again later.

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

    Drupal\Core\Routing\UrlGenerator->getRoute('entity.block_visibility_group.canonical') (Line: 276)
    Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.block_visibility_group.canonical', Array, Array, 1) (Line: 108)
    Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.block_visibility_group.canonical', Array, Array, ) (Line: 765)
    Drupal\Core\Url->toString() (Line: 109)
    Drupal\responsive_preview\ResponsivePreview->getPreviewUrl() (Line: 327)
    Drupal\responsive_preview\ResponsivePreview->previewToolbar() (Line: 33)

  • Status changed to Needs review 11 months ago
  • 🇺🇸United States DamienMcKenna NH, USA

    Thanks for putting that together. And yeah, I don't think this custom entity type should have a canonical URL either.

  • Status changed to RTBC 11 months ago
  • 🇺🇸United States a-fro

    Patch fixed our issue.

  • 🇺🇸United States DamienMcKenna NH, USA
  • 🇮🇳India ravi kant Jaipur

    Thank you @emerham
    The patch is working for me after apply below code and cleared cache.

                "drupal/block_visibility_groups": {
                    "Canonical Entity Link problems": "https://git.drupalcode.org/project/block_visibility_groups/-/merge_requests/9.patch"
                }
    

    @ Maintainers - is possible to me this MR so we don't need to apply patch.

  • 🇺🇸United States DamienMcKenna NH, USA
  • Status changed to Fixed 5 months ago
  • 🇺🇸United States DamienMcKenna NH, USA

    Committed. Thank you all!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024