Drupal 9.4: Route "entity.contact_form.entity_permissions_form" does not exist

Created on 13 June 2022, about 2 years ago
Updated 15 February 2023, over 1 year ago

Problem/Motivation

Visiting /admin/structure/contact/manage/{contact_form} on Drupal 9.4 throws an exception

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

Drupal Core 9.4 introduces a new "Manage permissions" tab after "Manage display"

https://www.drupal.org/node/3242827

Via annotation each entity type can now define a route to this new tab. Also the contact core module has implemented this for 9.4:

https://git.drupalcode.org/project/drupal/-/blob/9.4.x/core/modules/cont...

The consequence for the contact_storage module is that the hook "contact_storage_entity_type_alter" overrides "route_provider" for the entity type "contact_form" which then leads to this exception.

Steps to reproduce

- Install drupal 9.4
- Visit `/admin/structure/contact/manage/{contact_form}`

Proposed resolution

Do not override "route_provider" for "contact_form", instead do it as for the "contact_message" entity type:

   // Define the entity route provider.
-  $route_providers = $entity_types['contact_message']->getRouteProviderClasses();
-  $route_providers['html'] = '\Drupal\contact_storage\ContactRouteProvider';
-  $entity_types['contact_message']->setHandlerClass('route_provider', $route_providers);
-  $entity_types['contact_form']->setHandlerClass('route_provider', $route_providers);
+  foreach (['contact_message', 'contact_form'] as $entity_type_id) {
+    $route_providers = $entity_types[$entity_type_id]->getRouteProviderClasses();
+    $route_providers['html'] = '\Drupal\contact_storage\ContactRouteProvider';
+    $entity_types[$entity_type_id]->setHandlerClass('route_provider', $route_providers);
+  }

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇩🇪Germany h1nds1ght

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.

  • 🇮🇳India AswathyAjish

    I also got the same error.

    Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.contact_form.entity_permissions_form" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of /var/www/html/ADB-AP3F/core/lib/Drupal/Core/Routing/RouteProvider.php).

    I was using the contact storage module version 8.x-1.1. And I upgraded it to the version 8.x-1.3. Now the error disappeared and I can edit the contact us form.

Production build 0.69.0 2024