Problem/Motivation

I deleted a content type 'programme' which had two nodes in Trash. I didn't purge the nodes before deleting the content type. After a few days I wanted to edit the homepage which is using 'page' content type and not the 'programme' content type I deleted, but when I clicked on 'Layout' tab to edit the layout of the homepage I got a 'page not found' error. I clicked on the 'Edit' tab and got the error, Symfony\Component\Routing\Exception\RouteNotFoundException: Route "layout_builder.overrides.node.view" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 211 of /home/public_html/core/lib/Drupal/Core/Routing/RouteProvider.php).

At this point I wondered what happened to the page, I thought perhaps someone in the team mistakenly deleted the homepage. But it was loading fine. In any case, I tried to look for the node in Trash to see if someone deleted it. So I clicked on the Trash icon and got the error,

Warning: Undefined array key "programme" in Drupal\trash\Controller\TrashController->buildRow() (line 194 of /home/public_html/modules/contrib/trash/src/Controller/TrashController.php)

This now gave me the clue as to what was happening being that I deleted 'programme' content type. So I recreated the content type and the issue went away. I then purged the two nodes in Trash, and deleted the content type again.

Steps to reproduce

1. Create a content type
2. Create nodes of the content type
3. Delete the nodes to move them to trash
4. Delete the content type without purging the nodes in trash
5. Click on Trash
6. See the error

Proposed resolution

Maybe to automatically purge nodes in Trash when a content type is deleted or prevent the deletion until existing nodes are purged.

Issue fork trash-3527916

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chike created an issue. See original summary.

amateescu made their first commit to this issue’s fork.

amateescu’s picture

Status: Active » Needs review

Thanks for opening this (very detailed!) bug report :)

Automatically purging nodes would require a batch operation for that form, so I'd prefer to let the system work as intended and prevent the deletion of that content type instead.

  • amateescu committed e07d5a4e on 3.x
    Issue #3527916 by amateescu, chike: Deleting a content type with content...
amateescu’s picture

Status: Needs review » Fixed

Merged into 3.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.