Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

feature_toggle

1,402 sites Security covered
View on drupal.org

From Wikipedia

A feature toggle, (also feature switch, feature flag, feature flipper, conditional feature, etc.) is a technique in software development that attempts to provide an alternative to maintaining multiple source-code branches (known as feature branches).

http://en.wikipedia.org/wiki/Feature_toggle

This module gives non developers ability to show or hide features created & deployed by developers.

Configuration

Go to Administration » Configuration » System » Feature Toggle and you will see a listing page
which will allow you to enable or disable a feature.

Manage Features

From the listing page above, Site Administrators are capable to define new features or
Edit/Delete the existing ones.

How to get the status of a feature in PHP:

$status = \Drupal::service('feature_toggle.feature_status')->getStatus('some_feature');
if($istatus== TRUE){
  //Do something
}

How to get the status of a feature in Javascript:

if(Drupal.settings.feature_toggle.enabled["site_help"]){
  alert("Yes. site_help Feature is enabled");
}

Events are triggered when a feature is enabled/disabled:

/**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events = [];
    $events[FeatureUpdateEvents::UPDATE][] = 'featureUpdate';
    return $events;
  }

  /**
   * Event callback to react to FeatureUpdateEvents::UPDATE event.
   */
  public function featureUpdate(FeatureUpdateEvent $event) {
    \Drupal::logger('feature_toggle_example')->debug($event->feature()->name());
    \Drupal::logger('feature_toggle_example')->debug($event->feature()->label());
    \Drupal::logger('feature_toggle_example')->debug($event->status());
  }

Define access to custom routes based on feature status

It is possible to define route access rules based on the feature status.

my_module.feature_route_enabled:
  path: '/access/if/feature/enabled'
  defaults:
    _form: '\Drupal\my_module\Form\MyModuleForm'
    _title: 'Feature Enabled'
  requirements:
    _feature_toggle: my_feature.1

Define Access to Views based on feature status

Feature Toggle provides 3 different Views Access checkers:

  • Feature (Unrestricted): Only checks the feature status
  • Permission + Feature: Checks the feature status + a given permission
  • Permission + Role: Checks the feature status + a given role

Define Access to Blocks based on feature status

Feature Toggle provides a condition plugin that can be used for Block visibility or
other condition based plugins.

Its name is Feature Toggle and allows to define a list of features. If any of them is enabled,
the condition plugin will be evaluated to TRUE.

Access to features in Twig

Is possible to create conditional logic based on features in twig.

 {% if feature_toggle_status('my_feature) %}
  // Do something.
{% endif %}

Activity

Total releases
5
First release
Apr 2025
Latest release
10 months ago
Release cadence
12 days
Stability
60% stable

Release Timeline

Releases

Version Type Release date
3.0.1 Stable Jun 4, 2025
3.0.0 Stable May 27, 2025
3.0.0-alpha1 Pre-release Apr 21, 2025
3.x-dev Dev Apr 16, 2025
2.0.3 Stable Apr 16, 2025