versions installed : drupal 4.7.3, category 4.7.0, cck 4.7.0
To replicate: create a parent container that can only have children of type category-myccknode, where myccknode is a node you have created. When viewing the parent container page, I see the following links :
add child category - add child container
However, I have already defined that this container can only have children of type category-myccknode
The correct behaviour would be a link "Add child myccknode", linking to /node/add/content-myccknode/parent/$node_id
I'm new to drupal, so forgive me if this is an incorrect bug report. I have found a solution as follows, although I'm not sure if this is the correct way to fix this problem :
$ diff ~/category-4.7.0/category.module modules/category/category.module
256,260c256,267
< if (_category_privileged('create categories')) {
< $links[] = l(t('add child category'), "node/add/category-cat/parent/$node->nid");
< }
< if (_category_privileged('create containers')) {
< $links[] = l(t('add child container'), "node/add/category-cont/parent/$node->nid");
---
> if ($node->nodes) {
> foreach ($node->nodes as $node_type) {
> $node_name = node_get_name($node_type);
> $links[] = l(t("add child $node_name"), "node/add/$node_type/parent/$node->nid");
> }
> } else {
> if (_category_privileged('create categories')) {
> $links[] = l(t('add child category'), "node/add/category-cat/parent/$node->nid");
> }
> if (_category_privileged('create containers')) {
> $links[] = l(t('add child container'), "node/add/category-cont/parent/$node->nid");
> }
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | category.module | 67.06 KB | rosbif |
Comments
Comment #1
patchak commented"create a parent container that can only have children of type category-myccknode, where myccknode is a node you have created."
How to say to a container that he should have only one specific node type as a category?? I though you could assign nodes to containers only to say which content types would see the dropdown to get associated with categories from that container??
Interesting, do you have more details?
Thanks
Comment #2
rosbif commentedI did the following (after installing the category_transform module) :
- Create a category called 'Countries'
- using cck, create a type calles 'Country'
- under Settings > category > Content type settings, set 'Allow other content types to be Categories'
- - under Settings > category > Content type settings, deselect 'Categories' under 'Provide these content types'
- under settings » content types > Category behavior, chose "Category"
- in my 'Countries' container, under Container information > Types, select 'Country' as a node types I want to associate with categories in this container
hope that helps
Comment #3
rosbif commentedbtw I was following the instructions here :
http://category.greenash.net.au/node/158
Comment #4
patchak commentedWll I guess I'm too dumb to change a couple of lines of code, but I did not manage insert your code toget the desired behaviour. Could you by any chance post your full modified module file here so I could test you code myself as this is exactly what I need as well, (and what I though would be the default behaviour)
Thanks
Comment #5
rosbif commentedjust a warning - I'm pretty sure this isnt the correct way to fix this bug, as the fix should be in category_transform.module. Unfortunately I havent worked out how to override the function in category.module yet. Also my edit doesnt restrict access based on privileges, basically all users will be able to add new categories.
Comment #6
patchak commentedI guess you are right that we should not modify the module directly especially because of the user permissions, etc... maybe you should turn this into a feature request? Although I'm not sure if this is a bug or a feature...
The user can add the cck categories to your site, but have you set up the right permissions for your cck node??Thanks a lot and keep up the good work :)
patchak
Comment #7
marcoBauli commentedsetting this as CNR and changing title for remembering better what's about
Comment #8
marcoBauli commentedrosbif: this might be related to the more general issue at http://drupal.org/node/87827 you might want to have a look there.