I have ten content types that have tons of fields, including image fields with various image styles, etc. They are all mostly identical, except for a few fields. I would like to create one "master" content type and then copy it ten times. Then I could just change each of the ten copies to suite the different content types I need. This would save a TON of time. Keep in mind, this is all for the same Drupal installation. I'm not trying to copy a content type from one website to another. Is there a way to do this? I tried the Features module, and I did not have any luck, as all of my "features" were "overridden" and I gave up. I admit I did not try very hard, because I wanted to first make sure I wasn't going down the wrong path. Please help! Any assistance would be greatly appreciated. Thanks! - TheSasquatch

Comments

afaik, features is the way this is supposed to be done (at least that's what is says about the d7 version of content_copy functionality on the cck project page).

I would probably create a feature for the content type you want to use as the master, then just so a search and replace on the code to rename it for new content types.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

That sounds prone to unexpected glitches and other consequences. There should be a feature (core or community module) that allows for content types to be cloned with the click of a mouse. Any other ideas?

IIRC there was a content type export/import in CCK in D6. Not sure if it's still there.

nope-- that's the way i've always done it (though in d6 it was with the content_copy module).

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

Well, I appreciate your input, and if that's the best solution there is, I should try it. Can you please give me an example of the find-and-replace process? Like, if you could do a quick and simple example, and list the steps, that would be great. Thanks!!! - TheSasquatch

It mostly depends on your desktop environment. Just create the feature for the content type you want to be the parent (including whatever other items you want included), open up the text editor of your choice and do a search and replace on the content type's name (ie search for change my_content_type_name and replace with my_content_type_new_name) in the feature's files. Most editors (like notepad++) allow you to be able to do that for multiple files at once.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

cross-posting on this issue (with some more help) at http://drupal.org/node/1011620. Please see new module called bundle_copy, at http://drupal.org/project/bundle_copy.

Good luck,
-kbell

-Kelly Bell
twitter: @kelly, @gothamdrupal
http://gothamcitydrupal.com

Hi, kbell: thanks for the contribution. tried it out, but found it rather confusing to use. can the UI be improved to resemble the Node Converter in Drupal 6.x?

yup, sadly this is another common use utility that has been lost in D7. bundle copy does replace some of this but at the moment it is only for export/import to another site; it has no ability to clone to existing site.

The Field Tools module allows you to choose any fields in a content type and export them into another existing content type, file, user and/or taxonomy vocabulary.

I second this module, it was very very simple for me to duplicate all fields into an empty content type. Thanks for posting about it!

Agree, it was very easy to migrate existing fields to a new content type.

Great module - thank you for pointing it out. I can't believe it has only 462 reported installs!

agree, this module worked super fast for me, thanks for the recommend!

Yikes! Almost spooky how easy that is.

field tools is quite fast but note that it doesn't copy across field groups (features does).

This module is just what I needed; to clone most of the fields to a fresh new bundle. Thanks a lot for this suggestion. To integrate field groups would be great. But hey, to make few clicks on top of this beautiful module is not a problem.

Yep. 'Tis a beauty, thanks!

Yep, thanks

I am solve my problen with
http://drupal.org/project/bundle_copy
generate a export code
edit the source code (very easy)
import the code

As noted earlier in this thread, bundle_copy is intended for code export to a separate site.
If you don't edit the export code properly, you can foul up your site upon import. Only do this in a development environment.
@vacho - if you see my post, please reply to explain what parts of the code you edited. This will be helpful to others that attempt to use bundle_copy to clone a content type.

Thanks - Mike

edit the source code (very easy)

Please can you elaborate please. I guess this depends how complicated your content type is right?

Freelance Web Design and Development
---
http://www.danlobo.co.uk

I had a content type with 33 fields, and needed to create another content type that was nearly identical. The only difference was removing 6 fields. Bundle Copy worked like butter. I checked all boxes with one click, clicked the six I didn't need, copy/pasted the resulting export code into a text editor, find/replace the old type name with the new, and finally clicked Import under content types, pasted in the export code (with type names changed), and clicked submit.

Whoo, maybe kind of a run-on.

In any case, have to make sure the PHP Filter module is enabled and that you're a user capable of using that module, otherwise you won't find the import option.

That sounds pretty cool ,csuggs4 , but you are not cloning fields - you are "re-using" fields which is something very different. Cloning would create a new field + a new field instance while re-using only creates new instances. I would like to see a "clone field" option included in the "manage fields" UI.

This is exactly what I would love too. Have read the suggested solutions in this thread, but a clone content type, like in views would be the ultimate for me.