有没有办法在代码中执行规则操作?
我有一套规则,当某个工作流状态到达时,通过电子邮件发送作者。 在伪规则逻辑中:
Event: After updating existing content IF NOT [node:workflow-old-state-name] == [node:workflow-current-state-name] AND [node:workflow-current-state-name] == Published DO E-mail Author哪个工作得很好。 除此之外,我在某些地方直接调用workflow_execute_transition 。 这不会执行我的规则,因为它不是After updating existing content 。 在调用workflow_execute_transition之后,我想手动执行规则的操作(绕过条件)。 可能?
这一切都感觉像是一种解决方法。 为什么规则没有工作流状态更改的触发器? 工作流在核心的Trigger模块中正确表示,但在Rules中没有。
Is there a way to execute a Rules action in code?
I have a set of rules that e-mail the author when a certain Workflow state has been arrived at. In pseudo Rules logic:
Event: After updating existing content IF NOT [node:workflow-old-state-name] == [node:workflow-current-state-name] AND [node:workflow-current-state-name] == Published DO E-mail AuthorWhich works just fine. Except, I invoke workflow_execute_transition directly in some places. This doesn't execute my rule because it's not After updating existing content. I'd like to manually execute my rule's action (bypassing the conditions) after I call workflow_execute_transition. Possible?
This all feels like a bit of a workaround. Why doesn't Rules have triggers for Workflow State Changed? Workflow is properly represented in core's Trigger module, but not here in Rules.
最满意答案
嗯......结果规则确实有一个Workflow state has changed事件。 我只是一个背后的版本。
现在, workflow_execute_transition正在触发规则,从而解决了这个问题。
现在更干净了!
Well... turns out Rules does have a Workflow state has changed event. I was just a version behind.
So that solves this problem, now that workflow_execute_transition is properly triggering the rule.
Much cleaner now!
更多推荐
发布评论