Report prior to Node Delete

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
alexkb's picture

Hey people,

First post in this group, so please forgive me if the format is wrong.

Has anyone else come across a module that does the following prior to deleting a node:
1. checks (or knows from some storage mechanism) that the node being deleted is linked internally (ckeditor_link keeps rich text links as nid's rather than aliased paths and then converts them to alias's when the page is rendered via its own filter) in rich text or via node references,
2. possibly disable node delete if #1 is true, and display a report to the user explaining they must edit and remove the internal links and node references first.

The reason why we actually disable deleting if #1 is true, and not just blindly remove the links in the rich text, is because the link in rich text might be context sensitive, i.e. "Please click here to sign up for blahdeblah" - if that becomes unlinked, it could be confusing to end users.

If the module hasn't been done before, then I would suspect there is a reason for it.. there doesn't seem to be a decent hook to do this yet, but I think if the module's #weight was set low, and you simply used that node_delete hook, you should be able to interject that way.

I'd be happy to start the project off, but of course, don't want to be re-inventing the wheel.

Comments

Should be possible

mikeytown2's picture

http://api.drupal.org/api/drupal/modules!node!node.module/function/node_delete_multiple/7

Hooks are in the right places for a report. Stopping the delete does not look possible though

Here is how plone is doing

gmclelland's picture

Here is how plone is doing it.
http://dev.plone.org/raw-attachment/ticket/11992/linktegrity-non-ascii-t...

I have looked for this as well. What if you had a rule that fired on entity/node save that populates a multivalued entity reference field with links to all the entities that a node references either from the body or other fields.

Then when someone goes to delete an entity it could show them a confirmation with a view of all the nodes/entities that link to the node being deleted?

Anyways, a module that would handle this sounds really useful.