Trash for taxonomy?

Created on 5 December 2024, about 1 month ago

Hi guys,

This project is really great and working well but sadly, we discovered that it cannot be used for taxonomies and their terms. Are there any plans to include this functionality into the plugin at all, or is this an impossible task?

Thanks!

Feature request
Status

Active

Version

3.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @mambrus
  • 🇷🇴Romania amateescu

    The problem with taxonomy terms is their hierarchy, i.e. when "trashing" a term, what do you do with its children?

    One option could be to execute \Drupal\taxonomy\Entity\Term::postDelete() directly on the trashed term, with the downside that restoring the deleted term from trash won't restore the hierarchy for its previous child items.

    A possible fix for that could be to store additional "metadata" somewhere, which would be used in this case to store the child item IDs, and on restore you could ask the user if they want to re-parent those terms to the newly restored parent.

    It's not an impossible problem, it just needs a bit of time and thought :)

  • Thank you, @amateescu, I can see that the hierarchy thing is probably a bit complicated :)

    I think the question here also is what should happen with children when the parent is trashed. For me, the logical thing would be to also trash its child nodes (recursively, if they have their own child nodes), so they don't get orphaned, nor added to an arbitrary new parent. If they, however do have another parent, then, just as in the example here, I'd leave them be and only store metadata of the parent that's being trashed. Otherwise, we'd probably need to store metadata of all the trashed children (and possibly their children) as well.

    If trashing works like this, then we wouldn't even need to ask whether to re-parent the restored children once their parent gets restored, since they'd be restored alongside of it. Of, if they had another parent, then they'd get re-attached to the restored parent as well.

    I checked how Drupal's current delete on parent terms work and it seems that children terms are indeed auto-removed with the parent. So that functionality logically doesn't change from the default Drupal behavior.

    What do you think?

Production build 0.71.5 2024