Content type type?

barobba's picture

I have a several modules where I add functionality to a node based on the content type, and it would be nice to have a checkbox on the "node_type" form so that administrators could identify which content types should have the special functionality. Other modules do this like Organic Groups where you can identify if a content type is a group node or a group post.

For example, if the module is called "typetype" then developers could hook into this functionality by implementing HOOK_typetype().

function mymodule_typetype() {
  return array(
    'mymodule node' => array('My Module Node'),
    'mymodule post' => array('My Module Post')
  );
}

Then each content type form would have all the checkboxes: My Module Node, My Module Post, for site administers to identify which content types to identify.

These functions could also be available:

typetype_is_on($node_type, $type)
typetype_turn_on($node_type, $type)
typetype_turn_off($node_type, $type)

If this module or functionality exists somewhere then that would be great, but I haven't found it yet from the preliminary searching that I have done so far.

Comments

Similar idea

sreynen's picture

I'm not sure I follow your description, but I think it might be similar to something I've been thinking about for a while, which is a way to add fields to types rather than nodes within the type. This would allow, for example, to show a node/add page with only types that have a checkbox field set to TRUE, and display those types with logos from an image field.

I think the simplest way to do this might be to create a content type for content types, and auto-generate a node every time a new content type is created. Then the type nodes could be used anywhere normal nodes are used, in Views, Rules, etc. Slightly more complex would be to do this for all bundles, so user roles and taxonomy vocabularies could have fields as well.

Field all the Things

sreynen's picture

As a follow-up to this, I've started making this module, a little more general-purpose than what I described before:

http://drupal.org/project/fat_things

That would probably be more

barobba's picture

That would probably be more advanced than what I was thinking of.

I was just thinking about a simple checking functionality for developers, instead of assuming a particular node type in advance applies to a section of module code, administrators could identify that a particular node type for developers using a check box.

This doesn't take into account side-effects such as database or file changes made by a module, or what to do about existing nodes for a given content type, but that would be up to the developer to implement anyway.

This would just be an across-the-board on/off matrix of developer features made available by node type.

Contributed Module Ideas

Group organizers

Group notifications

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