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