"Content is going to be viewed" doesn't serve when trying to capture an edit event.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | workflow_ng_event_node_edit_5.x-1.x.patch | 1.38 KB | amitaibu |
| #4 | workflow_ng_event_node_edit_5.x-1.x.patch | 2.77 KB | amitaibu |
| #2 | workflow_ng_event_node_edit_5.x-1.x.patch | 1.52 KB | amitaibu |
| #1 | workflow_ng_event_node_edit_5.x-1.x.patch | 1.44 KB | amitaibu |
Comments
Comment #1
amitaibuI gave it shot, please review.
Comment #2
amitaibuSmall fix
Comment #3
amitaibuFYI, http://drupal.org/node/199283
Comment #4
amitaibuI've added also node revision revert, and node revision delete
Comment #5
fagogreat ideas.. :)
@strpos:
Why are you using strpos the compare the formids of the revision forms? Just check for $form_id == 'node_revision_revert_confirm' ?
In drupal, the coding style is to use
else if, not elseif
+ '#description' => t('Note that if drupal\'s page cache is enabled, this event won\'t be generated for pages served from cache.'),
that doesn't apply to these events.. just remove it. Furthermore the label "viewed content" doesn't suit to your events.
A problem, that might confuse people, is that this works only if the node is reverted using the drupal form to do so. If other modules, or e.g. a workflow-ng action reverts a form, it's not fired.
I'm not sure if it is possible to this in a way it works in any case. Perhaps it works to do a node_load() after the node is already saved, to get the cached copy of the old node, compare the nodes and fire the event if the revision flag has changed...
So as this doesn't work in general, I think it's not a good idea to add it to workflow-ng. Thinks get to complicated if they don't work in any case.. People just don't expect that. Perhaps, it makes sense to start a new module "workflow-ng bonus", which adds more workflow-ng stuff that is useful, but that doesn't fit to workflow-ng itself. What do you think?
Anyway, the node edit event works in any case - so I suggest we add only this one to worklfow-ng.
Comment #6
amitaibu1. strpos - I saw it in other modules. I assumed other modules might change the form name, but anyway next time I'll do it.
2. I'll try to find a more generic way for the revision. As you see I'm a beginer, but getting my ways :)
3. Good idea - kind of Workflow-ng bonous pack. It can have also a configuration of the node lock for example.
4. Yes, only the 'node is going to be edited' should be currently commited
Fago,
Should I create a new patch, or your going to edit the patch and commit?
Comment #7
fagoplease create a new patch, only containing the edit event.. So you get into rolling patches :)
@3: I'll look after creating one in the next days.
Comment #8
amitaibu1. Removed description.
2. Changed label to 'edited content'
3. reverted the form_alter to check only for node edit.
Comment #9
mitchell commented@Amitaibu: is this still worth pursuing?
There are "after updating existing content" and "content is going to be saved" events, but that doesn't seem like the same thing.
Comment #10
fagoThis would be possible once there is form-api support, see http://groups.drupal.org/node/20487.
Comment #11
mitchell commentedI believe this feature is necessary for the "Populate a node title" action to work. "Content is going to be saved" occurs too late, for instance, to replace automatic node titles. Is hook_validate the right event for this?
Comment #12
fagohm, Content is going to be saved shouldn't be too late, however autonodetitle probably overwrites your title if you use it together. Perhaps we could fix that by adding
to the rules action?
Comment #13
mitchell commented@fago: The problem isn't auto_nodetitle, it wasn't even installed. "Content is going to be saved" requires the form passes validation. From hook_nodeapi:
Comment #14
fagoah so you want to set the title for previewing? For doing that properly you would need forms support yeah (validation). You might be able to do it currently by detecting a "preview" with the view event somehow.
Comment #15
mitchell commentedInteresting idea, fago. 'When content is going to be previewed' would work consistently, as long as you required the user to preview the node before submitting.
This issue seems like it needs to be broken up, so I'm adding a 'rules forms support' tag.
Comment #16
intent commentedmitchell, this sounds like exactly what I'm looking for. In my case, I need to validate a date entry prior to saving. I'm forcing a preview, so a rule triggered on preview would seem to allow me to perform a validation before saving - perfect.
Comment #17
klausiThis should be fixed with the new Forms Support submodule, have a look at the dev version of rules.