If I create a container by clicking the 'add child container' link of an exisiting container, the parent (in container information) is always shown as root and not the actual parent container. Saving this obviously saves it under root and not the right container. The url shows the right parent, though (or so it seems to me).

I am able to select the right parent manually and create the container under the correct hierarchy, but I think this should happen automatically. The current behaviour is okay when you are creating the container at create content>>container. There, it should rightly default to root. But, not when a child container link is clicked in an exisiting container.

CommentFileSizeAuthor
#1 category.inc-create-child-container.patch709 bytesbdragon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdragon’s picture

Status: Active » Needs review
FileSize
709 bytes

This patch fixes this issue for me.

venkat-rk’s picture

I will test again on a new install of the latest category module with and without the patch and report back.

liquidcms’s picture

doesn't work with arbitrary types (i.e. cck types as categories)

haven't been looking at categories for awhile.. surprised this capability isn't in place yet.

liquidcms’s picture

ok, well i took a look at the code and at the point where the patch is trying to set the parent and $node->parent_cont is not set... so I still get root.

but looking further into the code i don't see a $_GET anywhere (to pull my parent off the url).. so maybe i am missing the point of all this.. and that might explain why this obvious "improvement" has not been committed yet.

so.. is this the point???

i have a url that looks like this: /node/add/content_myccktype/parent/408

and i want the default (actually i want the only available value) under category information -> parent to be the term for 408.

I am petty sure i can just fix this outside of the cat module in a form alter... just not sure why this isn't the default behavior.

liquidcms’s picture

this patch breaks the ability to add a child container to a node.

liquidcms’s picture

well, again not sure why this isnt part of this module already.. but in case i am missing some fundamental as to why this shouldnt be fixed.. here is the hook_form_alter way to fix it outside of the cat module:

function example_form_alter($form_id, &$form) {

    switch ($form_id) { 
        case 'content_new_cck_cat_type1_node_form':
        case 'content_new_cck_cat_type2_node_form':    
            $parent_nid = arg(4);
            foreach ($form['catinfo']['parents']['#options'] as $key=>$option) {
                if ($key != $parent_nid) unset ($form['catinfo']['parents']['#options'][$key]);
            }
            break;
       
    }
}

this simply pulls out all the options from the Parent pull down list and leaves you with the one you told it to use in the url like this:

/node/add/content_new_cck_cat_type1/parent/234

Peter Lindstrom
LiquidCMS - Content Management Solution Experts

liquidcms’s picture

one addition to this.. this will break when EDITING the node... code should be this instead:

            if (stristr($form['#action'],"/add/")) {
                $parent_nid = arg(4);
                foreach ($form['catinfo']['parents']['#options'] as $key=>$option) {
                    if ($key != $parent_nid) unset ($form['catinfo']['parents']['#options'][$key]);
                }
            }
            break;
liquidcms’s picture

although my code works like a charm to auto-parent my categories when they are created.. sadly, the activeselect module wipes my parent setting out after the page is loaded.. and therefore now way for me to set it back.

too bad the category module doesn't have the ability to disable activeselect for the actual admin task of setting up categories and leave it on for the more user like action of tagging content

i guess i will have to hack the cat module to disable for my current project. i'll post patch to hack on in a new issue when i get the patch

JirkaRybka’s picture

Version: 4.7.x-1.x-dev » 6.x-2.0-rc1
Status: Needs review » Fixed

I don't exactly know the point in time, where this got fixed, but it works just fine on 6.x branch. I tried "add child container" under both an existing container and existing category, and it shows pre-selected as expected.

So, based on that observation, setting this issue to "fixed" status.

The 4.7.x version (for which this was initially open) is not supported anymore. (And 5.x in fact too...)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.