Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Feature toggle

2,102 sites Security covered Drupal 10–11
View on drupal.org

Allows site administrators to enable or disable features without code changes. Developers can use this module to toggle backend features, and site builders can control the visibility of routes, views, and blocks based on feature status.

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 %}

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
6
Tracked since
Apr 2025
Latest release
1 month ago
Releases (12 mo)
1 ▼ from 5
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
3.0.2 Stable 10–11 Jul 16, 2026
3.0.1 Stable 10–11 Jun 4, 2025
3.0.0 Stable 10–11 May 27, 2025
3.0.0-alpha1 Pre-release 10–11 Apr 21, 2025
3.x-dev Dev 10–11 Apr 16, 2025
2.0.3 Stable 9–10 Apr 16, 2025