Go to the Stanford University web site
or
Log In
(To add something to the Commons.)

Cloning a Content Type in D7

With the move of fields into core in Drupal 7, much of the functionality of CCK has been rendered obsolete.

Unfortunately, the Content Copy module seems to have gone by the wayside. As of May, 2011, the project page for CCK states, "content_copy : The D7 branch of the Features module supports expoting (sic) and importing content types and fields in 'feature' modules. There is currently no UI to manually export and import field definitions."

Which is all well and good, but it's a little tricky to use Features to clone or duplicate a content type on an existing site. At least, several hours of Googling proved unproductive for me.

Here's what you need to do:

  1. Export the content type that you want to clone as a Feature.
  2. Re-name the content type (i.e., change the "machine name") in your Drupal site
  3. Upload and enable your Feature

Sounds easy, right?

(Note that if you have any existing nodes of the original content type, they will be converted to nodes of the new type. This may affect any CSS or hook_form_alter() that you have going on.)