Problem/Motivation

When multiple features are selected in the Feature Toggle block visibility
condition, the condition evaluates to TRUE if any of the selected
features is enabled (OR logic). However, the form title "When the following
features are enabled" implies that all selected features must be
enabled (AND logic). There is no way to configure AND behaviour, making it
impossible to gate a block on multiple features simultaneously.

Steps to reproduce

  1. Create two feature toggles: feature_a and feature_b.
  2. Enable only feature_a.
  3. Configure a block visibility condition using Feature Toggle, selecting both feature_a and feature_b.
  4. The block is visible, even though feature_b is disabled.

Proposed resolution

Add an explicit OR / AND operator option to the condition form. The operator
defaults to OR, preserving full backward compatibility with existing
configurations. When AND is selected, the condition only evaluates to TRUE
when all selected features are enabled.

The form labels are also updated for clarity: the operator field is presented
as "Show this block when…" with plain-language option labels, and the feature
list description is simplified to "Leave all unchecked to always show."

Remaining tasks

None.

User interface changes

The block visibility condition form gains a new "Show this block when" radio
field (OR / AND) rendered above the feature checkboxes. Existing configurations
are unaffected — they default to OR on save.

New field "Show this block when"

API changes

None.

Data model changes

The condition plugin configuration gains a new operator key
('OR' or 'AND'). Existing stored configurations
without this key fall back to 'OR' via a null-coalesce guard,
requiring no migration.

CommentFileSizeAuthor
screenshot.jpg137.74 KBtregismoreira
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tregismoreira created an issue. See original summary.

tregismoreira’s picture

Status: Active » Needs review