Presets

Primary tabs

The presets module provides an API for creating a set of settings to accomplish more advanced functionality on a site that requires multiple modules set up a certain way. Traditionally, the only way to accomplish this was to create a “recipe” or howto of how to set everything up and hope people could follow it.

These howtos often looked like this:

Download and install these modules.

Create some content type with these fields.

Create some views with these properties.

Set up some vocabularies like this

Go to this module’s settings page and enter your API key.

Go to this module’s settings page and set this up.

Oftentimes a step was a little vague or misunderstood when being followed by an end user and after following the instructions, things didn’t work. In addition, the end user didn’t really know what they did right or what they did wrong and how to fix it.

This is where the presets module comes in. Presets allows a developer to not just develop a “howto” for setting up some functionality but to add checks and quick fix links to each of those settings. With presets you can say which modules are recommended for the feature, have a list of settings for those modules with help in setting them up, and a general overview of if each of those settings are set correctly.

Essentially this module is a programmatic howto for setting up functionality on a website. It can be used to define easy to use steps to get functionality working. It is very similar to the Requirements page of drupal in providing an overview of the status of settings but is designed around functionality specific presets.

Examples of what presets could be used for:
Setting up SEO Modules to optimize content for search engines.
Create an events calendar.
Setting up a media player or for your website.
Anything that previously was a checklist of what to do to get some awesome functionality.

If you have a “howto” list similar to the one above, consider implementing presets in your modules to create an easier to use setup experience.

How is this different than Features?

Features solves a similar but different problem than presets and there is some overlap. There are things that features cannot do right now though, partly due to design decisions in Drupal 6 and partly due to things that shouldn't be hard coded across websites like API keys. These are the types of things that Presets does well. It is not an export of settings like features is, it is a guide to setting up the system. First, there is a list of modules that should be installed. Second, there are checks to make sure settings are set correctly (this is most similar to features). Because this is done programmatically though, we can check to make sure that a variable is set for each content type on the system. This is not possible with features because there is no way to know which content types are on each system. Third, users are prompted in to enter API Keys and any other settings that are site dependent like the google maps API key or the google analytics key. Finally, Presets must be custom programmed. There is no export ability since that isn't what it is supposed to do. Developers who are trying to help people set up their modules in conjunction with other modules and settings can implement presets to walk people through the setup process.

Preset Module

Drupal 7 Version

With Drupal 7, we've decided to move this functionality into apps instead of porting the presets module. The only module that we know of that uses presets is the seotools module which will be an app in Drupal 7.