UndefinedLinkTemplateException when adding a new OG role in the UI

Created on 27 February 2025, about 1 month ago

Problem/Motivation

When adding a new role in the OG UI, the following error occurs:

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'og_role' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 211 of core/lib/Drupal/Core/Entity/EntityBase.php).

This suggests that the og_role entity is missing a canonical link template, which is required when calling toUrl().

Steps to reproduce

  1. Navigate to People > Roles > Add role in an OG-enabled site.
  2. Attempt to create and save a new role.
  3. Observe the error message.

Proposed resolution

  • Define a canonical link template for the og_role entity in its entity type definition.
  • Ensure that toUrl() is only called when the necessary link templates exist.
  • Investigate whether this issue originates from the OG UI module or the OG module itself.

Remaining tasks

  • Confirm if the issue is reproducible in a clean Drupal install with OG enabled.
  • Investigate where toUrl() is being used and why it lacks a canonical link.

User interface changes

Big error is gone!

🐛 Bug report
Status

Active

Version

1.0

Component

og.module

Created by

🇨🇦Canada joelpittet Vancouver

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