Allow deleting Content Template entity without deleting source Node

Created on 10 March 2025, 26 days ago

Problem/Motivation

Currently, the Content Templates module does not provide a way to delete the template entity itself without deleting the original node from which it was created. This limits the flexibility of template management and can lead to accidental deletion of important nodes.

Upon investigation, I noticed that the form for deleting content template entities already exists:

class ContentTemplateDeleteForm extends ContentEntityDeleteForm {}

However, this form is not currently used in the module.

Steps to reproduce

  1. Create a new content template based on an existing node.
  2. Go to the template listing page.
  3. Open the operations dropdown menu and select "Delete."
  4. The system deletes the original node along with the template, instead of allowing just the template deletion.

Proposed resolution

Add the ability to delete only the content template entity without deleting the source node. This can be implemented by:

  • Utilize the existing ContentTemplateDeleteForm to allow deletion of only the template entity.
  • Add a 'delete-form' instruction to the content template entity annotation like this:
links = {
  "collection" = "/admin/content/template",
  "delete-form" = "/admin/content/template/{content_template}/delete",
},
  • Add a "Delete" button on the template editing page that uses this form.
  • Modify the operations dropdown menu in the template listing to correctly link to this form instead of deleting the original node.
Feature request
Status

Active

Version

1.0

Component

User interface

Created by

🇩🇪Germany jakoloborodun Rostock

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024