Currently, the order of category->parents is broken during the node submit hook. I was looking into ways to fix this.

The attached patch provides a new utility function to sort a parent list, and uses it near the top of category_submit().

The function has a side effect of removing duplicate cids.

CommentFileSizeAuthor
category-sort-before-save.patch2.18 KBbdragon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdragon’s picture

Reading this over, I realize that I should clarify the last part.

If a parent got listed multiple times (which can happen due to the way the parent selection forms operate), the returned array will still only list it once.

In other words, this works as a possibly "better" version of my fix for the "category_hierarchy duplicate entry" problem. (patch on #0 from http://drupal.org/node/76921, patch on #2 of http://drupal.org/node/92818).

Jaza’s picture

@bdragon: http://drupal.org/node/92818 has been committed. Is this patch really needed? If you still think it should be committed, then please report back on what specific improvements / bug fixes will result from it, and on what performance hit this patch will incur.

bdragon’s picture

Status: Needs review » Postponed

Ok, the point of this patch is to keep $node->parents and $node->parent properly sorted at all times.

This is more of a "test and see if it fixes any random problems you were having with X" patch than anything else...

I haven't found any specific bugs fixed by this, and I don't think this patch is commit-worthy (too slow), but it's worth keeping around for testing.

Setting the issue to postponed.

bdragon’s picture

Status: Postponed » Closed (won't fix)

WONTFIX, this is no longer relevant.