I tried using the taxonomy super select module... and the options for tss wouldn't save.

I've traced this bug back to the way the included taxonomy.inc taxonomy_hierarchical_select_form_alter(..) merges the two arrays for form elements using a union.

I think the only handler we want to override is taxonomy_form_vocabulary_submit, but when we take the union in combination with the 3 submit functions hs uses, the first two extra submit handlers are overridden by the hs ones.

The solution is to array merge the 2 extra submit handlers.
If we array merge everything except the handler mentioned above, we end up with duplicates after the 3rd element.
I've tested the patch for no extra submit handlers and for one extra submit handler.
My logic seems okay here... so other than re-writing that union entirely, this one liner fixes this problem.

Sorry about the horrible explanation.

Cheers,
Michael

Comments

pingers’s picture

Hi Wim,

Just wondering whether you've had a chance to look at this bug?

It's basically a step towards compatibility with other cck modules using submit handlers... otherwise there's a good chance they will be overridden by the hs handlers.

Michael

wim leers’s picture

I'm going through everything in chronological order, so I'll look at this pretty soon, if time permits.

pingers’s picture

No probs ;) Thanks!

Michael

matteo.boria’s picture

StatusFileSize
new706 bytes
new1.81 KB

These are two patches (NOT for 5.x-3.x-dev, but for 5.x-2.2).
The first one use a "radical" approach: I don't see any reason to "break" the $form array. Consequently, this patch simply append the new HS values to original array (with a little correction for the "false" multiple select)

The second patch (light) keeps the whole structure. Here, the only correction is to change the union (+=), which overrides any other value for $form['#submit'] with array_merge_recursive, much more conservative.

In my installation, HS run properly.
Oher modules, too (the origin of this post is the interaction of HS with Taxonomy Delegate module, see http://drupal.org/node/256432)

I'm not really a Drupal guru, so, if someone want to review the code, is welcome...

Ciao;
Matteo
------------------------------------------------
[Sorry for my engrish...]

wim leers’s picture

Title: Submit handlers overriden by union » Submit handlers overridden by union
Status: Needs review » Fixed
StatusFileSize
new928 bytes

matteo.boria: thanks for the effort, and your English isn't bad at all ;) However, I'm not making any changes to HS 2.x anymore, so your patches won't go in! Also, the slicing of $form is less extensive in HS 3.

pingers: good catch! I obviously forgot about this. I've found a slightly more elegant easier solution though, as you can see in the attached patch :)

P.S.: I forgot to credit you in the commit :( Sorry!

pingers’s picture

All is forgiven! :)

Just glad it wasn't all for nothing ;)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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