Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Use it for questions about the module used by site developers to export elements of a site configuration to use them in another site.

Features enables the capture and management of a collection of Drupal entities which taken together satisfy a certain use-case. For example, a content type, related fields, defined views, and panels to implement the content type on a site could be packaged as a feature and placed on a new site being developed. The newly defined 'Feature' will be stored as a module and enabling it will add that functionality to the new site.

Definitions There are a few definitions needed to clear up semantic confusion.

  • Features is a contributed Drupal module identified by this tag.
  • Feature is a definition of a collection of site elements collected in a custom module as the result of using the Features module. It is the work product of the module.
  • features & feature (lower case) are generic references to thing(s) you want your site to do.

A basic concept behind the Features project is the intention of separating configuration from content. For instance, a developer may create a content type such as blog entry type with customized fields, views, panels, context blocks, and other similar related elements of a sites configuration. This collection of structurally related elements are used to create the blog feature you may use on multiple sites. The actual content of the blog will differ from site to site, but the assembly of its operation will remain consistent. Features provides the ability to encapsulate the 'blog' feature for distribution. The new site can then generate its own blog entries using the same format.

The advantage of this approach is that the configuration of the feature is contained in code, and not the database. The developer can take advantage of all the tools available in Drupal to impose version control, use Drush, & etc to continue development and distribute upgrades to each site using the Feature.

Installation & Operations Notes:

  • Although Features can be used to transfer content to another site, it may not be a good idea to include node content in a Feature with the configuration unless it is intended for inclusion on a multiple sites.
  • Features can be accessed through the admin/structure/features menu.
  • Use care in selecting a name for a Feature. Just like any other contributed or custom module, it should be unique, to avoid conflicts that could confuse Drupal operations.

Resources

history | excerpt history

Code Language (used for syntax highlighting): default