[Drupal 7] Unfeaturize a Content Type

David G - DrupalIn the past I’ve detailed about ways to export your site configuration to code using Drupal. This is important so you can manage moving your website from 1 server to another, like a Development server to a Production server (changes). Possible tools I’ve described in the past to move configuration around within Drupal are Features and the Configuration module. When using Features — features takes ownership (or tries really hard to own your configuration) of your exported Content Types in Drupal.  In Drupal buzzwords we say Features locks the content type from future changes. Sometimes it’s nice to undo the death grip Features has on your content type.

Example of a Feature

If we create a simple content type, called MyCustomType, with a few basic fields in Drupal it appears as follows:

A basic content type created using the Drupal 7 Field UI.

A basic content type created using the Drupal 7 Field UI.

Having created our content type we can use the Features module to create a Feature for use on our website. We simply select the content type and it’s fiels are auto selected by Features for inclusion in the feature.

Create new Feature administration page.

Create new Feature administration page.

We then export the feature to a .tar.gz file and then extract the folder to our /sites/all/modules folder and use Drush or the Module listing page to activate the new Feature. We can then see the Feature is installed:

Installed Features administration list page.

Installed Features administration list page.

Features registered components of our installed feature.

Features registered components of our installed feature.

So now our Feature is installed on the website. But, what did I mean when I said Features locks the content type? Well, we cannot edit the machine_name of the Feature for example on the Content Type admin pages. Let’s take a look at the database settings of the Content Type (here I use PHPMyAdmin, use the tool you like most):

Database settings for exported Feature module. Note the "locked" column value.

Database settings for exported Feature module. Note the “locked” column value.

Unfeaturizing this Feature

How can remove this locking? Essentially we modify this locked boolean field of the content type. Recently, a small module was created to help with this task called the Unfeaturize module.

The directions by the project creator of this module are provided on the project page, they are:

  1. Disable the feature (module) that owns your content type
  2. Enable this module (make sure you have permission to administer content types)
  3. Visit admin/config/development/unfeaturize
  4. check the boxes for the content types you’d like back
  5. click the “Unfeaturize” button.
  6. Profit.

Note: don’t Uninstall the Feature owning your content type — That would be Bad.

So if we work through these steps, at step (3) we are given choices on content types to unfeaturize:

Select the item you want to unfeaturize.

Select the item you want to unfeaturize.

We can then see after unfeaturizing our content type that we may now edit the machine name of the content type, horray!

Viola, now we can edit the content type fully as the database owns it again and not Features.

Viola, now we can edit the content type fully as the database owns it again and not Features.

If you end up using Features I hope you find this small tutorial helpful!

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , | Posted under Drupal | RSS 2.0

Author Spotlight

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at david.gurba@arvixe.com

Leave a Reply

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