Submitted by admin on Thu, 09/12/2019 - 14:57

When you create a feature like a photo gallery, slideshow, blog or forum for Drupal, it involves installation of quite a few individual modules. In addition, each module often requires a lot of configuration.

Wouldn't it be nice if you could just create a feature just once and reuse it time and again, no matter how many modules and much configuration it needs?

That's the goal of the Features Module for Drupal. Create something once. Re-use it easily on as many sites as you wish.

Create a feature before you start

Before you can experience the power of this module, you need to actually create a feature. A feature might be a photo gallery, slideshow, calendar or something even more complex.

In this tutorial, we're going to use a sliding testimonial feature. Here's a tutorial showing how we created it: Using the Views Slideshow Module in Drupal 7. If you want to follow this Features tutorial exactly, please go through the steps of the Views Slideshow tutorial first.

Image removed.

To minimize the confusion while you're learning, we also suggest you have a clean Drupal site to install your new feature on. It will be less complicated when you go to check your work.

Step 1. Download and Install the Features Module

Step 2. Create the Feature

Go to Structure > Features and click Create feature.

These are the settings you'll need to enter:

  1. Name: make sure this is a unique name and not used by anything else. Do not use a term like blog or audio that might be used by a native module or one you might install.
  2. Description: Describe the package.
  3. Package: Create a group name for your feature.
  4. Version: This will actually become a module you can install, so be sure to include the actual Drupal Version here.
Image removed.

Step 3. Edit Components: Content type

  • Scroll down to Edit components.
  • Choose Content types: node.
Image removed.
  • You will see the display of the content types you have defined.
  • Choose Testimonial (or whichever one you want to build the feature for.)
Image removed.
  • Most of what needs to be included in the feature is shown as auto-detected on the right side of the screen after you choose the content type.
Image removed.

Step 4. Edit Components: Views

  • Choose Views from Edit components dropdown.
  • Choose the Testimonial Slider view.
Image removed.

Step 5. Edit Components: Add the Image Style

  • Repeat the process we used above to add Image styles: image and the testimonial_thumbnail to your feature.
  • There may be much more that needs to be added depending on the complexity of your feature. Discovering what is essential is a lot easier with the fewer components you have on the site and the simpler the feature. That's why we suggest starting with a clean install and a new and simple feature until you get experience.
Image removed.

Step 6. Download the feature you just created

  • Scroll to the bottom and click Download Feature.
  • Download the file and save it to a directory on your computer.
  • On your other site, go to Modules > Add New > Browse and upload the file you just downloaded. It will install just like any other module.
Image removed.

Step 7. Enable the feature on the new site

  • Go to Modules after you install the feature and you will see the new feature installed. Notice that on this fresh install, I am missing a couple of required dependencies, Features and Strongarm. This won't work until all the requirements are installed. I'll install those now.
Image removed.

 

Step 8. Start using the new feature

  • The new feature is represented by a new content type that was automatically added.
  • All the settings and views that I created when I created the original testimonial slider are also included. I could also have included the permission settings or any other settings for components that were available in the "Edit Components" field.
  • Essentially I have "rubber stamped" the Testimonial slider and can now install it on any site like any other module. You can do this with any feature you create.
Image removed.
 
Solutions Img