Problem/Motivation
After install this module, when i want to remove menu item from my node i have got this error:
Error: Call to a member function delete() on null in menu_ui_form_node_form_submit() (line 374 of core/modules/menu_ui/menu_ui.module).
menu_ui_form_node_form_submit(Array, Object)
call_user_func_array('menu_ui_form_node_form_submit', Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('node_content_type_page_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('node_content_type_page_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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: 135)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 57)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Proposed resolution
I can see that menu_item_extras attach service "menu_item_extras.menu_link_content_helper" in line 309, which do the same like function menu_ui_form_node_form_submit() in core menu_ui module, but core do not check if $entity object is not null.
API changes
- Detach this services?
- Fix this issue
Comments
Comment #2
volegerYes, there are few submit callbacks that handle creation menu link of the node in the related bundle.
So in that situation, it is better to remove deletion logic from the module and keep that task for node callback.
I will update dev ASAP.
Comment #4
volegerThis fix in the 8.x-2.x-dev branch.
Comment #5
hussainweb@voleger, thanks for fixing the issue. How about creating a new release so that we don't have to move to dev version? I think an error like this warrants another release as there are no workarounds on the current stable version.
Comment #6
hussainwebI see that we have a new release with this fix. Thank you!
Comment #7
voleger