ANY / ALL (conditions on list items)

Last updated on
30 November 2019

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

These plugins are found in Rules List Conditions.

ANY

ANY item in list:
  item == other_item

But ANY is far more general and allows you to test for properties of the items, like

ANY item in list:
  item.quantity >= 5

or

ANY item in list:
  item is type 'page'

, to check that any item in the list has a quantity greater than or equal to 5 or that any item in the list is of the page content type. Not to mention since it's a conditions plugin you can check multiple properties (or sets of properties by embedding an OR container in the loop body).

ALL

The 'loop body' of ALL is a condition container that runs on the individual items in the list being looped over. ALL evaluates to true only if every single item in the list being looped over causes its loop body to evaluate to true. So

ALL item in list:
  item.quantity >= 5

would be true if EVERY item in the list has a quantity greater than 5 (whereas the version with ANY returns true only if at least one has a quantity greater than 5).

Help improve this page

Page status: No known problems

You can: