Example #1 - An Online Videos feature

Last updated on
22 December 2016

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

In this example, we create an Online Videos feature. The site builder configured a lot in preparation of this feature we are currently not interested in.

Step 1. admin/build/features/export

As you can see we added a name, description, and a version. Next step will be defining what this feature provides.

Step 2. Select features components.

From the "Add Components" dropdown we have to select the components the feature consists off. This is a video node so we select "Node". From the checklist, we only need the video node type.

The auto-detect functionality grabs the required building blocks node (video), content (video-field_video), modules (emvideo, features). Therefore, when we want to install the feature, we need to make sure we have installed the required modules.

Step 3. Download the feature.

When satisfied with all components, click the download button and save the tarball (in this case, online_videos-6.x-1.0-alpha1.tar.gz).

Step 4. Install and enable the feature.

Best thing to do is untar the file in your current project. As described above, features are not listed on the site/build/modules page even though they are technically modules. To keep them separate, you should consider putting all of your features in a separate directory — e.g., site/all/modules/custom/your-feature.

The feature now appears at admin/build/features. Checking the box next to the feature's name and saving page causes the features module to check for the current state all features.

Step 5. Visit admin/build/modules

When checking for the module online video module it's not there. Searching for the name would show you a dependency on an online_video module. To disable such a module you have to disable the feature first.

Notes

  • We have said nothing about what drupal projects you need to install to be able to install our example feature.
  • If we had created a view this would be exported too. test it yourself.

Help improve this page

Page status: No known problems

You can: