Problem/Motivation
menu_link_content module can provide menu links regardless of whther menu_ui module is installed.
However the cleanup for nodes being deleted is in menu_ui:
/**
* Implements hook_ENTITY_TYPE_predelete() for node entities.
*/
function menu_ui_node_predelete(EntityInterface $node) {
...
}
So, non-node entities are not handled and this is not handled if menu_ui is uninstalled.
Proposed resolution
Generically handle entity deletion in menu_link_content module
Remaining tasks
doit
User interface changes
none
API changes
none
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | interdiff.txt | 2.33 KB | amateescu |
| #22 | 2350797-22.patch | 4.02 KB | amateescu |
| #22 | 2350797-22-test-only.patch | 1.6 KB | amateescu |
| #19 | 2350797-19.patch | 4.12 KB | dagmar |
| #3 | 2350797-3.patch | 4.08 KB | pwolanin |
Comments
Comment #1
dawehnerOne of many more issues.
Comment #2
pwolanin commentedtest fix
Comment #3
pwolanin commentedhandle all possible entity routes.
Comment #6
pwolanin commentedper dawehner, need to fix Views so it properly returns all the page displays in the list of templates.
Comment #7
dawehnerHow to get all routes provided by a particular view (at the moment):
Comment #8
pwolanin commentedHere's what I have so far for adding to the View class, but discussing with dawehner, maybe we should postpone additional Views cleanups until e.g. #2350503: Add route generation handlers for entities is done
Comment #9
pwolanin commentedbump
Comment #12
pwolanin commentedbump
Comment #15
pwolanin commentedThis bug still exists in 8.4
The views bug was fixed, so this should be viable to be worked on now
Comment #16
catchThanks for checking if this was still valid.
Discussed with @alexpott, @cilefen, @cottser, @laurii, and @xjm and we think it's worth bumping this to critical since it's a data integrity bug (albeit leaving cruft as opposed to deleting too much). Looks to me like since the menu links will still be valid, we'd be trying to load the entity to check access every time, even though it's not there - as opposed to it only being extra rows in the db.
Comment #17
catchComment #18
xjmComment #19
dagmarRerolled after #2776975: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase, #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase), and probably some other change but I couldn't find the issue.
Comment #22
amateescu commentedReviewed the code and it makes sense. Here's a fix for the test and some cosmetic fixes.
Going straight to RTBC because my changes are minor.
Comment #25
catchCommitted/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!
Comment #27
xjmComment #28
mikran commentedI've found a new problem that comes with this. Module uninstall is broken if configuration is being deleted during the uninstall. Here is one example how to reproduce:
This gives error
Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("entity_type_id") to generate a URL for route "entity.entity_view_mode.add_form".I was able to reproduce this with drush and from UI.
Comment #29
dawehner@mikran
Please create a new issue and link it from here. This way people don't need to read the old discussion ... Thank you
Comment #30
mikran commentedComment #32
malik.kotob commentedAfter this change was introduced I'm getting the following error when attempting to delete an entity belonging to a custom content entity type generated by Drupal console:
The link has the following form: "/admin/structure/personnel/{personnel}/revisions/{personnel_revision}/revert". The {personnel} parameter is populated properly, but the {personnel_revision} parameter is missing, hence the error. Is there something we should be doing in code to ensure the revision parameter is passed in? Not too familiar with the routing system.
Comment #33
hchonovIt looks like the change here is now preventing the deletion of entities having custom link templates with mandatory parameters, which are not automatically set by
\Drupal\Core\Entity\EntityInterface::toUrl(). I've created an issue for this - #2924338: Entity::uriRelationships() throws exceptions if an URL cannot be generated because of missing mandatory parameters, which is a major as it looks like an usual case when e.g. using the diff module and suddenly after an update inside 8.4.x it is not possible to delete entities.Comment #34
cburschkaIn addition to the bug above, we now also lose unparameterized collection routes. For example, menu links that point at
/admin/peopledisappear when a user is deleted.#2926897: Deleting content entities also deletes collection menu items.