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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | overridden_submit_handlers.patch | 928 bytes | wim leers |
| #4 | hs_taxonomy.patch | 1.81 KB | matteo.boria |
| #4 | hs_taxonomy.light_.patch | 706 bytes | matteo.boria |
| taxonomy.inc_.patch | 401 bytes | pingers |
Comments
Comment #1
pingers commentedHi 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
Comment #2
wim leersI'm going through everything in chronological order, so I'll look at this pretty soon, if time permits.
Comment #3
pingers commentedNo probs ;) Thanks!
Michael
Comment #4
matteo.boria commentedThese 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...]
Comment #5
wim leersmatteo.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!
Comment #6
pingers commentedAll is forgiven! :)
Just glad it wasn't all for nothing ;)
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.