Conditions
The Conditions module provides tools for site builders and developers to create and manage reusable sets of rules. These rules, called conditions, can be added to forms and fields, allowing editors to configure display logic for content, and developers to determine what content is shown to whom based on these rules. This includes features for managing complex rule groupings and efficiently querying entities based on their assigned conditions.
The Conditions module provides reusable form elements, a field type, and services for working with Drupal's condition plugins — the same plugin type used for block visibility (request path, language, user role, and many more provided by core and contrib).
It lets site builders expose condition configuration to content editors directly on any form or field, and lets developers evaluate those conditions at runtime to decide what to show, where, and to whom.
Features
conditionsform element — renders a configurable list of condition plugins with AND/OR logicconditions_groupsform element — renders multiple groups of conditions, each with its own logic and a published/unpublished toggleConditionsService— initializes condition plugins (including context mapping) and resolves nested condition groups at runtimeconditions_fieldsub-module — a field type that stores conditions as one row per condition (indexed by plugin ID), so entities can be queried efficiently by the conditions assigned to themConditionsFieldService— bulk lookups of condition data by entity ID or by condition configuration- AJAX-enabled widgets for managing condition groups directly on entity edit forms
Requirements
Getting started
The base module provides no admin UI of its own — integrate the conditions/conditions_groups form elements in your own forms, or enable the conditions_field sub-module to add a "Conditions" field to any entity type via the Field UI.