Allows for completely excluding individual features components from the features UI and features exports.
This module is useful when there are features components that you want to make sure NEVER get exported. If you are using features for site building or deployment then you've probably ran into the issue of someone accidentally exporting timestamp variables like cron_last or update_last_check. You may also want to banish permissions for developer modules so they don't get caught up with the rest of the site permissions you want to export. Banished items will not show up in your feature module OR ANY OTHER FEATURES MODULE, so use with caution. For a central list of features that should never be exported, see https://www.drupal.org/node/2400531
To banish a features component, you have 3 options:
- Banish the component in your feature's mymodule.info file
- Set the 'features_banish_items' system variable
- Implement hook_features_banish_alter()
Features 2.6+ Required
To actually alter the options from features, a small patch is currently needed. See #1999254: Add ability to ignore arbitrary components As of June 8, 2015 - this functionality is in features 7.x-2.6+. Discussion about making this a core features ..well, feature is here if you are interested: https://www.drupal.org/node/2505463
The UI is read-only
You'll need to set these options in code for now, but there is a read-only UI in the features settings at admin/structure/features/settings which will list the currently banished components.
Examples
Banish the component in your feature's mymodule.info file
Note that this needs to be a features module to be picked up. You will know if you see this in the info file.
features[features_api][] = api:2
Just replace:
features[some_component][] = some_item
with
features_banish[some_component][] = some_item
Real Example:
features_banish[variable][] = cron_last
features_banish[variable][] = update_last_check
Set the 'features_banish_items' system variable
There isn't a UI for setting this variable, but you can set it using the normal methods, like variable_set(), or the drush vset command. Note that this only adds to the list, so you can't remove a banishment by setting altering this variable. You might also want to add it to your settings.php file during development to clean up the features ui. Contrib modules probably shouldn't use this.
// In settings.php
$conf['features_banish_items'] = array(
// Exclude temporal settings.
'variable' => array('cron_last', 'update_last_check'),
// Remove dev permissions
'user_permission' => array(
'access devel information',
'execute php code',
'switch users',
),
// Remove the dev modules from dependencies.
'dependencies' => array('devel', 'views_ui', 'ds_ui'),
); Implement hook_features_banish_alter()
Modules can add, modify, or remove banished features with an alter hook. See features_banish.api.php for more details.
/**
* Implements hook_features_banish_alter().
*/
function my_module_features_banish_alter(&$banished) {
global $conf;
$keys = array_keys($conf);
$banished['variable'] = is_array($banished['variable']) ? $banished['variable'] : array();
foreach ($keys as $key) {
// Banish most of the annoying __active_tab variables.
if (strpos($key, '__active_tab') !== FALSE) {
$banished['variable'][] = $key;
}
}
}
}
Project information
- Project categories: Developer tools
61 sites report using this module
- Created by frankcarey on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.

