UndefinedLinkTemplateException: No link template 'delete-form' found for the 'menu_link_config' entity type

Created on 28 February 2023, over 1 year ago
Updated 3 March 2023, over 1 year ago

Problem/Motivation

After installing the module in Drupal 9.5.3 and trying to add a menu_link_config link to a menu, a WSOD error occurs:

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'delete-form' found for the 'menu_link_config' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).
Drupal\Core\Config\Entity\ConfigEntityBase->toUrl('delete-form') (Line: 119)
Drupal\menu_link_config\Plugin\Menu\MenuLinkConfig->getDeleteRoute() (Line: 461)
Drupal\menu_ui\MenuForm->buildOverviewTreeForm(Array, 50) (Line: 289)
Drupal\menu_ui\MenuForm->buildOverviewForm(Array, Object) (Line: 150)
Drupal\menu_ui\MenuForm->form(Array, Object) (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm('menu_edit_form', Object) (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 713)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Install the module to Drupal 9.5.3 and add a config link to a newly created menu.

Proposed resolution

Add links annotation to docblock on entity class, since they are already there but not registered for the entity:

 *   links = {
 *     "delete-form" = "/admin/structure/menu/link/{menu_link_config}/delete",
 *     "edit-form" = "/admin/structure/menu/link/{menu_link_plugin}/edit",
 *     "add-form" = "/admin/structure/menu/manage/{menu}/add_config_link",
 *   },

Remaining tasks

Testing

User interface changes

None

API changes

None

Data model changes

NOne

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany fisherman90 Dortmund

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

Comments & Activities

Production build 0.69.0 2024