How to create Features and add components with Drush in Drupal


Creation

drush fe --d --destination="sites/all/modules/custom"  my_feature views:my_view

We can find this information in the .info file

name = my_feature
core = 7.x
package = Features
dependencies[] = views
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[views_view][] = my_view

Enable your Feature

drush cc all
drush en my_feature

Adding Components

To see that components are available to add into your feature we’ll run Feature Compile

drush fc
If we get something like this:
Available sources
image:adaptive
image:thumbnail
image:medium
image:large

I could add into the .info file the following syntax.

features[image][] = thumbnail

Update the Feature

via Drush usingdrush fu, short for drush features-update.

drush --d fu my_feature
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s