This project is not covered by Drupal’s security advisory policy.
Conditional Features provides the ability to enable or disable modules based on conditions set by the site administrator.
Features
It utilises Condition Plugin API in the same manner as Drupal entities such as Blocks are able to do.
It also provides its own Condition plugin which enables Blocks and other entities that take advantage of the Condition Plugin API to be enabled or disabled based on Conditional Features.
Installation
Install using composer in the usual fashion:
composer require drupal/conditional_features
Post-Installation
After installation, visit /admin/structure/conditional-features to create and manage conditional features.
A Conditional Features Manager service is provided to allow developers to interact with conditional features that have been created.
Get instance of the Conditional Features Manager:
$conditional_features_manager = \Drupal::service('conditional_features.manager');
Get an array of all conditional features:
$features = $conditional_features_manager->getFeatures();
Get an array of only enabled conditional features:
$features = $conditional_features_manager->getEnabledFeatures();
Get the state of a conditional feature (by ID);
$state = $conditional_features_manager->isEnabled('disabled_feature');
$state = $conditional_features_manager->isEnabled('enabled_feature');
Similar projects
Feature Flags: Possibly feature complete but doesn't appear to be supported any longer (over a year since last update).
Feature Toggle: Doesn't appear to be supported/maintained any longer (over a year since last updates, lots of open tickets that haven't had any attention)
Switches: Maintainer has suggested this project is abandoned and to use one of the alternatives.
Project information
- Project categories: Developer tools
- Created by welly on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
Development version: 1.x-dev updated 14 Dec 2023 at 10:45 UTC
