In the Scenarios module, condition elements serve as filters that further qualify the previous scenario event or action. For example, if you include a Views event that is triggered when a visitor displays any page, you can follow it with a condition that further qualifies the event according to the type of browser the visitor uses to generate the request:

This section describes how to add your own custom condition elements if the default set does not meet your requirements. In the previous section of this chapter, the example showed how to add a custom action, LogAction, that printed out the contents of its parameters. This section develops that example and shows how to add a condition called moonPhase that performs the print action only if the moon is in a given phase on a particular date.

The procedure for adding a custom condition is similar to the procedure for adding a custom action element as described earlier. It can be summarized as follows:

loading table of contents...