Allow other node types to also be categories / containers (like event module)

Jaza - March 14, 2006 - 12:18
Project:Category
Version:HEAD
Component:Code
Category:feature request
Priority:normal
Assigned:Jaza
Status:closed
Description

See http://category.greenash.net.au/node/121 for details.

#1

KarenS - April 5, 2006 - 16:44

+1 on this idea. I am working with CCK and it would be great to be able to make CCK nodes into categories so you can give them back/next links, etc. The same would apply to flexinode nodes. The back/next links are already a feature request for CCK and I was trying to see if there was any way to do it using category, but I guess not yet.

#2

Jaza - April 5, 2006 - 22:57

You can already turn other node types (such as CCK nodes) into categories and containers, using the category_transform module. But category_transform is for turning individual nodes into categories, not for turning whole node types into categories. This is not as powerful, but it is available now.

#3

KarenS - April 6, 2006 - 11:39

I missed that module completely. That's great, I tried it out and it actually is a pretty good solution. I've posted this as a possible solution on the cck feature request for back/next links.

#4

marcoBauli - April 15, 2006 - 17:09

I'm currently building a site that needs this feature to come to life, so i express my full interest in this! I also offer to donate to anyone who could make this feature work in a timely manner.

Thank you
marco

#5

MentalFS - May 4, 2006 - 14:14

category_transform should get settings to automatically transform certain node types to a category/container in a certain container.

This could be a possibility to make comments nodes. Imagine forum posts automatically being categories in a container called "topic". You could now create a simple node type called "comment" and assign it to a topic - voilá! Now you can at least create a flat forum structure completely without the comment.module.

I would love to see this feature, there are many other good ways to use it. I would like all of my "projects" being categories, so I could make project-specific blogs. Maybe it could also be possible to create subforums automatically (but I don't think so).
I'm not good at this but I'll take a look into the code later.

#6

Jaza - May 8, 2006 - 13:58
Assigned to:Anonymous» Jaza
Status:active» fixed

This feature has now been committed to the category module, for the HEAD and 4.7 branches! Changes that this patch has introduced:

- New settings group on the 'admin/settings/category' page, called 'content type settings'.
- Setting called 'allow other content types to be:', with options 'categories' and 'containers'. This setting is effectively what globally enables or disables the entire 'allow other node types to be categories / containers' functionality (and it is currently DISABLED by default).
- Setting called 'provide these content types', with options 'category' and 'container'. This setting enables or disables the two node types that are built-in to the category module - they are ENABLED by default, but you may want to disable them if you only want to use your own custom node types with the category module.
- If you disable the built-in content types, they will be removed from the definition in hook_node_info(), and the relevant settings will also be removed from your 'admin/access' page.
- On the 'admin/settings/content-types/x' pages, there is a new setting called 'category behaviour', which ONLY appears if you have enabled at least one option for the global 'allow other content types to be:' setting. This is what actually allows you to toggle category / container behaviour for other node types.
- For any node type that you assign category or container behaviour to, all the category- or container-specific form elements will be added to the node add/edit form for all nodes of that type (new or existing).
- Category and related modules have been updated to be fully insert-update-agnostic. That is, insert and update operations have all been merged together, and the responsible functions now determine whether an insert or an update SQL query is appropriate at every step (by checking for existing data). This is necessary to be able to reliably update existing nodes that previously weren't categories or containers, and to give them category or container behaviour (also benefits category_transform as a side effect).
- Save operations are now called via hook_nodeapi() for any nodes that are of a type defined to have category or container behaviour.

TODO item (probably won't be implemented just yet):
- Allow users to restrict categories of a certain node type to belonging in certain containers (e.g. categories of type 'film genre' can only belong to the 'film genres' container).

#7

Jaza - May 10, 2006 - 14:52

The "Allow users to restrict categories of a certain node type to belonging in certain containers" feature has been developed and committed, but will not work ATM unless http://drupal.org/node/62829 is applied (will work out of the box when this patch gets committed to core).

#8

marcoBauli - May 16, 2006 - 09:58

The patch has been committed today to head.

#9

gauss - May 17, 2006 - 04:05

Using the latest cvs code when I've assigned a content type to be a container and another to be a category when I go to edit or create a new category the container drop down is empty? Am I missing something really obvious?

#10

gauss - May 17, 2006 - 04:07

Forgot to add this only happens with node types I've assigned to be categories. If I use the category content type it works no problem.

#11

Jaza - May 17, 2006 - 04:21

Try downloading the latest version of Drupal 4.7, either direct from CVS, or as a tarball from here:

ftp://ftp.osuosl.org/pub/drupal/files/projects/drupal-4.7.0.tar.gz (the http:// prefix works as well)

Quite possibly, you're experiencing this bug, which was only just fixed for 4.7 (and which was fixed specifically to make this feature of the category module work).

#12

gauss - May 17, 2006 - 04:49

Thanks for the speedy reply.

Here's where I'm at, new test install of Drupal 4.7 from that link. Latest category from CVS.

Only category and cck modules added. Created two content types. One as container and one as category. Created a container then tried to add come new content as a category. Container drop down is still empty.

#13

Jaza - May 17, 2006 - 04:55

The tarball (that I posted a link to) does not yet have the patch applied (the tarball only gets updated every 6 or 8 hours, I believe). Wait for the latest tarball to get generated, or check out category direct from CVS:

cvs -d :pserver:anonymous@cvs.drupal.org:/cvs/drupal-contrib -r DRUPAL-4-7 checkout contributions/modules/category

#14

gauss - May 17, 2006 - 05:09

I've just tried it with the latest CVS of 4.7 that includes the fix to forms.inc

Getting the same problem, nothing showing up in the container drop down. Nothing but CVS Drupal , CCK 4.7 and CVS category installed.

#15

gauss - May 18, 2006 - 00:48

Downloaded the latest CVS of everything again this morning and it's working.

Thanks again, great module.

#16

Anonymous - June 1, 2006 - 01:00
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.