How to Export Node Options and Text Formats in Drupal 7

The Features module is a powerful module which allows developers to bundle site configuration into a module. You could use Features to export content types, fields, views and a whole lot more. However, often I see developers have trouble exporting node options and text formats when they are still new to the Features concept.

In this article, I’ll go through why you should install Strongarm and how to export “Text formats”.

For more details about Features check out the project page and have a look at the “KIT Feature Specification” which is part of the Kit project.

Install Strongarm Module

The heading pretty much says it all, make sure you install the Strongarm module when using Features. Strongarm allows you to override and export site configuration that is stored in the variable table into code.

When you export a content type into a Features module, you’ll need Strongarm to export the content type options. Options within the vertical tabs are stored in the variable table.

Fig 1.1

How To Export Text Formats

The Features module gives you the ability to export “Text formats”. Just select “Text formats: filter” from the “Edit components” drop-down list.

Fig 1.2

However, make sure you also export the corresponding permission because “Text formats” are attached to user roles.

Fig 1.3

Just remember, when exporting a “Text format” you’ll need to export the filter and permission together.

If you have any questions, please leave a comment.

About The Author

10 thoughts on “How to Export Node Options and Text Formats in Drupal 7”

  1. In my experience at work, we’ve had issues exporting permissions to Features because:
    1. Drupal needs to know a permission exists in a module or it will throw a database error when it tries to set the permission in the DB. So if a filter format (or anything else for that matter) is declared by a not-yet-enabled feature/module, or in a new hook that Drupal hasn’t yet picked up, this will happen on applying the feature containing the permission.
    2. Similary, any custom roles that are assigned a permission in its features export must already exist on the site, or a database error will occur.

    We used to use Features to manage our permissions, but hit too many of these issues during development because of our dev/deploy workflow (where we all work on a single shared branch), so have stopped doing so. Exporting Text Formats and Strongarm stuff works well for us though so I’d still recommend doing that.

    1. It can get tricky trying to figure out the order in which Features modules are enabled. For custom roles, I often create the roles in a installation profile.

  2. Check out the Configuration Management module as well. It’s much more straightfoward than Features and is trying to keep inline with Drupal 8 concepts.

  3. i recreate features module, applied this changes then download and updated my files, cache cleared but still no change for role producer for producer_saved_html means permission still unchecked

    1. You need to export the corresponding filter permission (“Filter: Use the Full HTML text format”) and the actual filter with Features.

      Also, I removed the link to the image in your comment because I got a 404 error when I viewed the link.

  4. I have created a text formats filter called “full html”. When I try to export it, I never see it. I am able to create another text formats filter and I am able to see it. Any idea

    1. It could be a possible namespace collision. If you installed Drupal using the standard installation profile, then you’ll already have a “Full HTML” text format. You can not have two formats with the same name.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top