My intent is to perform an action whenever a specific taxonomy vocabulary is modified and saved (terms reordered, name or description change).
I have the following rule:
Event:
After updating an existing vocabulary
Data comparison condition:
Data to compare: [vocabulary:machine-name]
Data value: my_vocab_machine_name
Action:
Show a message on the site
Message: Yeah! my taxonomy was modified
All "Saves" from the Vocabulary "edit" form (the one that has the name and description) results in the intended message being displayed along with the appropriate system message, perfect. After saving the vocabulary from the edit form, the FIRST term reordered (drag/drop) and save operation from the vocabulary terms "list" results in the intended message being displayed. From that point forward all subsequent term reorder and save operations DO NOT result in the intended message being display instead only the system message "The configuration options have been saved." is displayed. The pattern of one reorder save after an edit save reproduces every time.
Am I missing anything? Is there a better event to trigger off of to get all term reorder then save events?
Thanks in advance, Jim P.
Comments
Term or vocabulary?
I'm a bit confused – do you want the rule to react on taxonomy term saves or vocabulary saves?
I was also a bit surprised that the vocabulary event is triggered when you reorder the taxonomy terms. Maybe there is some information in the vocabulary about the first term in its list – and this causes the vocabular to be updated and saved when you replace the top term.
//Johan Falk
**
Check out NodeOne's Drupal Learning Library! 200+ screencasts and exercises, for Drupal introduction, advanced configuration, and coding. Creative Commons license!
Vocabulary
Johan,
Thanks for the reply (love the screen casts by the way, keep up the good work).
In this case I want the rule to react to saves of the vocabulary. I have other rules for term creation and modification that are working as expected.
Reordering the vocabulary terms does not fire an event. It's the required save of the vocabulary resulting from the reorder that causes the event to fire. The issue is the event only fires after the first "Save" while on the vocabulary "List" tab. After the first save, do another reorder and then save. The event will not fire. Now go to the "Edit" tab and do a save (which in itself causes the event to fire as expected and does so every time) and then go back to the "List" tab and do a reorder/save and the event will fire (but just that once).
In my opinion it's a bug. For now I'm working around it by always doing a Save on the Edit tab of the vocabulary.
I plan to root cause the issue (good way to learn the underlying bits) when I get a chance.
Huh.
Now I understand better. Seems strange indeed.
Good luck with the bug hunting!
Same Issue
Hey Jim!
I have the EXACT same issue, the weird thing is EXACT to a point that I'm successfully save the first reorder, but not more after.
Can you find a solution finally??
MineS
workaround
i used https://www.drupal.org/project/rules_forms and it works.