CCK Content type for referencing other content types

Events happening in the community are now at Drupal community events on www.drupal.org.
darrellduane's picture

Does anyone know if there is a module to create a field in a content type that allows you to reference one or more other node types?

I've had a few times where it would be nice to be able to select from a list of the node types in the system. In my case, I have 10 or so node types that are used to hold data for a specific type, and for my content type that indicates what the type is (of which there are 20 types), it'd be nice to indicate which node type is used by that type to hold the relevant data.

I'll likely build this module myself if no one is aware of anything that does this, I've been searching the list of modules under CCK and haven't found anything yet.

Comments

Content Type Content Type?

sreynen's picture

I'm not aware of anything that does this and I'm interested in it. I actually have making something like this on my long-term to-do list. More specifically, what I've been thinking about is a content type for content types. So as content types are created, edited, and deleted, those changes are synced to nodes. This gives you the ability to reference content types as you've described with the existing node reference module, and also the ability to add fields, taxonomy, etc. to content types, so you could give content types icons, organize them into groups, and so on.

Quick solution using existing field

arpieb's picture

Create a text field with one of the options-based widgets (checkboxes, select, radio, etc) and instead of giving the value|label option list, leverage the PHP code setting to generate the associative array directly from the Drupal API (this example is from D6):

<?php
$options
= array();
$types = node_get_types('types');
foreach (
$types as $type) {
 
$options[$type->type] = $type->name;
}

return
$options;
?>

No real need for a new CCK widget...

There is a need if you

Garrett Albright's picture

There is a need if you believe that the PHP filter should never, ever be used for anything, ever, which you should.

That being said, I don't quite understand the OP's use case. But more power to you.

Contributed Module Ideas

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week