Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2009 at 16:59 UTC
Updated:
29 Jul 2014 at 18:09 UTC
i just ran into an issue in trying to create a rule where i wanted to perform an action on delete of a node, but the action is conditional on the value of a field in the node that is being deleted. unfortunately, since the event exposed is "after deleting content", the field and its value no longer exist to validate the condition one way or another.
maybe this is not something you can get at, i don't know, but if it were possible to expose a "content about to be deleted" event, you would then be able to evaluate fields in the node before doing an action.
does this make sense?
Comments
Comment #1
fagoIt does make sense, but rules just relies on the hooks provided by the node module. As long as there is no such hook, we have no way to do that (in a clean way).
Comment #2
ManyNancy commentedWill this be possible in d7?
Comment #3
mitchell commentedMoving this to the core dev branch that is accepting feature requests.
@sziggle: For 6.x and 7.x, I think you'll need to find a workaround solution; for example using a 'trash' flag, and batch deletion on cron. We could discuss this in another support request.
Comment #4
mautumn commentedI think it is very rare to unconditionally delete something. Take orders for example. One would almost certainly want to make sure that the order had not been completed or published - or some other condition/s - before allowing it to be deleted? I'm very surprised this hasn't been requested much more. In my first foray into Rules this was one of the first things I looked for...
Great module BTW.
Comment #5
mitchell commentedComment #6
bailz777 commentedI think that this functionality if available would really catch on. I know that I could use it right now. I am using drupal as an interface to connect to multiple api's. each provide a similar service. I want to delete a node based on the return value from the api, but the function to return a value should only be initiated after the user clicks delete. If on the 3rd party side there is an error, I would like to have the option of not completing the delete process.
Comment #7
mitchell commentedprotected function preDelete($entities) { }