Hi,

Since rules can't be rearranged, are they query-wise fired from top to bottom?  I'm trying to have 2 separate rules in that order:

  1. Frontend editable checkbox field gets checked on a post (Pass On Field rule)
  2. Flag the node if that editable checkbx is checked, then reset a certain editable dropdown field's value and do a page redirect (Pass On rule)

The thing is, if it all gets executed from top to bottom, "Pass On" comes before "Pass On Field", but "Pass On" should be the final reset and redirection. The redirection doesn't happen with the field method, only when clicking the direct flag link.

I decided to use a field checkbox for cosmetic reasons since the flag toggle appears in the node body. I would like to generate a layout block for the flag link. If you got anything please let me know.  

 

Clicking on "Save" if the checkbox is checked should basically constitute a "Content updated" event, but the rule doesn't fire so far. Is saving an editable field a content update?

Comments

Hi flightrs. You have several questions packed into one posting ;-)

To answer your question about rules order:

Rules are triggered by hook invocations. For example, when you save an existing node, that invokes rules_entity_update(), which is an implementation of hook_entity_update(). So, only rules that respond to the event "After updating existing content" will be invoked. Rules that correspond to other hooks that happen during a node save (e.g. hook_entity_presave() - which corresponds to the event "Before saving content") will be invoked in the order of the hook invocations. In Backdrop, hook_entity_presave is always invoked before hook_entity_update, and therefore those rules with event "Before saving content" will always be invoked before those with "After updating existing content", regardless of where they appear in the UI.

Now, if you have multiple rules that react to the same event, then the order will be the one shown in the UI. The UI order corresponds to the id column in rules_config, from smaller to bigger. So, if you have two rules that react to "Before saving content", and you want rule B to be invoked later that rule A, then you should create rule B after you create rule A. There is no reordering of rules in the UI, as you noticed.

I see in your snapshot that you have an event "A node is bing flagged, after Pass it on". Is that a custom event you created? Is it attached to a specific hook in Backdrop?

In the latter part of your message you ask "Is saving an editable field a content update?". Are you referring to the editable fields that the module Editable Views provide? If so, the answer is yes. hook_entity_update() and therefore the rules that react to "After updating existing content" are all invoked.