On a recent Drupal (link) project, I installed the Environment Indicator module (link). One of the great aspects of this module is that it integrates with the Features (link) module. After featurizing the module’s configuration, I decided that I also wanted the feature to include the user permissions. I found that there are multiple ways to add a component to an existing feature.
We use Drush (link) for all of our Feature manipulation – although it can be slow, it is must faster than using the UI. To create the Environment Indicator feature, I first had to get the name of the component:
drush fc //result  : environment_indicator_environment
To create the Feature:
drush fe -y --version-set="7.x-1.0" global_environment_indicator environment_indicator_environment --destination="sites/all/modules/custom/global"
Used the Feature Export (link) command to create the Feature:
Feature Name: global_environment_indicator
Feature Component: environment_indicator_environment
Feature Version (optional): 7.x-1.0
Feature Destination (optional): We generally place these in our custom modules folder.
-y (optional): Ignore prompts – confirm automatically
After my feature was created, I decided to add the user permissions to the feature. I first had to find the component names:
drush fc //result  : user_permission
After entering 49, I found that the user permissions for the Environment Indicator were:
user_permission:administer environment indicator settings user_permission:access environment indicator user_permission:access environment indicator default_environment user_permission:access environment indicator dev_environment user_permission:access environment indicator stage_environment user_permission:access environment indicator prod_environment
To add the components to my Feature, I would normally enter:
drush fe -y --version-increment feature_name component_name component_name ...
The component names are separated by spaces, but the sources for the component also included spaces:
user_permission:administer environment indicator settings
So I added quotes to the sources:
drush fe -y --version-increment global_environment_indicator user_permission:"administer environment indicator settings" user_permission:"access environment indicator" user_permission:"access environment indicator default_environment" user_permission:"access environment indicator dev_environment" user_permission:"access environment indicator stage_environment" user_permission:"access environment indicator prod_environment"
I then verified that the features was updated by viewing the file: global_environment_indicator.info. the Feature was successfully updated.
Adding a component to Existing Feature without Drush
Another quick way to add a component to an existing Feature is to first add the components to the .info file:
features[user_permission] = administer environment indicator settings features[user_permission] = access environment indicator ...
And then run the Feature Update command:
drush fu -y --version-increment global_environment_indicator
That’s it. Adding a component to an existing Feature is fairly straightforward. Enjoy.