Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Leaflet 10.4.13 — Minor update available for module leaflet (10.4.13). Release: Flag 5.1.1 — Minor update available for module flag (5.1.1). Release: Layout Paragraphs 3.0.0-beta5 — New beta version released for module layout_paragraphs (3.0.0-beta5). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

Flag Mutually Exclusive

Security covered Drupal 11 · not 10

Part of the Flag ecosystem · 12 projects

View on drupal.org

This module allows you to configure pairs of flags so that only one flag in the pair can be set on an entity at a time. For example, if you have a "like" and "dislike" flag on a post, setting one will automatically remove the other.

This module enforces mutual exclusion between configured groups of (Flag module) flags on the same entity. When a user sets one flag in a group of flags on an entity, the remaining flags are unset.

Features

The Flag module does not natively enforce mutual exclusion among flags. This module adds that capability by listening to Flag's ENTITY_FLAGGED event and automatically unsets the counterpart flags when one flag in a configured group is set.

Common use case:

  • like/dislike reactions (group of two flags) where a user can hold only one at a time. Any number of groups can be configured, across any entity types and any flags that Flag supports.
  • multiple choice settings (groups of multiple flags) where a user can select only one selection at a time. Up to 10 flags can be configured in a group. Common examples might be: subscription levels on a member plan, multiple choice options on an exam, user polls

Post-installation instructions are summarized below, additional documentation is contained in the module’s README file.

Breaking change (Release 1.1.x) : prior to this release, the module used a “pairs" model (exactly two flags per rule, stored under a pairs config key). This release replaces pairs entirely with a groups model (2-10 flags per rule, stored under a groups config key). Existing pair configuration is automatically migrated to groups the next time you run database updates — see "Upgrading from 1.0” in the README.

Post-Installation

1. Navigate to Administration → Structure → Flags (/admin/structure/flags) and add the flags that are intended to work as a mutually exclusive group. Make a note of their names, and the entity type to which they're configured to apply.

2. Navigate to Configuration → Content authoring → Flag mutually exclusive
(/admin/config/content/flag-mutually-exclusive) and click Add group.

Configuration is exported as part of flag_mutually_exclusive.settings and
is included in drush config:export / drush config:import deployments.

Setting Description Label Human-readable name for the group, e.g. "Like / Dislike" Machine name Unique identifier, auto-generated from the label Entity type Machine name of the entity type all flags in the group apply to Flags 2 to 10 flags — setting any one unsets all the others in the group. The list refreshes via AJAX to show only flags compatible with the selected entity type, and a counter shows how many are currently selected. Enabled Uncheck to temporarily disable without deleting

Configuration is exported as part of flag_mutually_exclusive.settings`and
is included in drush config:export / drush config:import deployments.

Additional Requirements

- Drupal ^11.3
- flag:flag (>=5.0.0)

Similar projects

Rules can be used to configure this functionality. However Rules is heavyweight, this module targets a specific set of functionality that managed Flags on entities in a specific manner, and provides that functionality without the overhead of Rules.

Supporting this Module

This module is supported by Lisa Harrison (lisa.rae), an individual contributor and long-time member of the Drupal community.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
7
Tracked since
Jul 2026
Latest release
2 months ago
Releases (12 mo)
7 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.1.0-beta1 Pre-release 11 Aug 4, 2026
1.1.x-dev Dev 11 Jul 26, 2026
1.0.1 Stable 11 Jul 26, 2026
1.0.0 Stable 11 Jul 14, 2026
1.0.0-beta1 Pre-release 11 Jul 2, 2026
1.0.0-alpha1 Pre-release 11 Jul 2, 2026
1.0.x-dev Dev 11 Jul 2, 2026