When configuring some fieldsets as vertical tabs and leaving others as regular fieldsets, I'd like to position all the vertical tabs above the regular fields.
Rearranging the group order in CCK is the obvious fix, but the menu and book fieldsets (and a few others) keep floating to the top.
So I set up an after-build function and reset weights on all the top-level groups, then resorted $form to the order I'd like ... but the menu and book fieldsets keep floating up to the top.
Apparently, CCK has some issues setting weights (http://drupal.org/node/290411), and it makes sense for this module to follow CCK group weights. But absent the ability to control group order in CCK, is there some other way that I've overlooked to force all the vertical tabbed fieldsets to the top?
Thanks ... and nice module!
Comment | File | Size | Author |
---|---|---|---|
#14 | 444378-14.vertical_tabs_cck_weights.patch | 2.22 KB | dww |
#13 | 444378-13.vertical_tabs_cck_weights.patch | 2.2 KB | dww |
#8 | vertical_tabs_pre_render.patch | 7.23 KB | quicksketch |
#6 | vertical_tabs_cck.patch | 1.1 KB | KarenS |
Comments
Comment #1
snorkers CreditAttribution: snorkers commentedI agree - this would be a nice facility to be able to re-order the sequence of vertical tabs, as a few 'randoms' seem to float to the top of the list.
Comment #2
quicksketchThe "official" way to order tabs is simply to re-order the fields using CCK (admin/content/node-type/[type]/fields). Any modules that don't expose themselves to CCK should have the functionality added so that they appear on this list of fields as well.
Comment #3
quicksketchAlso related #357708: Adding weight to the fieldset?. Marking as fixed, since it's not the responsibility of Vertical Tabs to make fieldsets reorderable.
Comment #5
KarenS CreditAttribution: KarenS commentedReopening this so people will see this comment. Reordering fields using CCK will not work because CCK applies the weights in pre_render, too late for Vertical Tabs to react to them. I've posted a patch for CCK at #409144: content_extra_weights gets corrupted and breaks the ordering of form elements on node edit form which I think will fix this, but I want to get input from the other CCK maintainers before committing it.
Comment #6
KarenS CreditAttribution: KarenS commentedOK, as you will see in that issue, the weights are not set by CCK during hook_form_alter, they are set later, so Vertical Tabs will not have the right weights with the current code. A simple patch will fix this problem by retrieving the adjusted weights using a CCK helper function.
Comment #7
quicksketchUgh, seems ugly to me. Vertical Tabs already has a weight of 300 I think, which should ensure it's last-run order. However, if CCK uses #pre_render to adjust weights, then we've got a bit of a problem. I think the preferable course of action would be to move Vertical Tabs weighting to #pre_render also, so it will fire after CCK. It'll also make the D6 module more like the D7 core version, which also uses pre_render.
Comment #8
quicksketchThis patch switches Vertical Tabs to a pre_render function instead. I think it should fix the problem if I'm understanding it correctly.
Comment #9
luckysmack CreditAttribution: luckysmack commentedHaving the same issue, i tried the patch in #8 against the beta3 release and works great.
Comment #10
dboulet CreditAttribution: dboulet commentedThanks for the patch!
Comment #11
bomarmonk CreditAttribution: bomarmonk commentedI'll review this patch and come back with my results. Thank you!
Comment #12
Dave ReidThis needs to be re-worked in order to allow other forms besides the node form to be able to use this. See the latest CVS change in #500044: Extend the support to different modules / form pages.
Comment #13
dwwMarked #613784: Vertical tabs weights incorrect (cck interaction issue) duplicate with this. Nothing new there, just FYI.
Ran into this bug myself, so I decided to take a shot. Rerolled for latest DRUPAL-6--1 branch as per Dave Reid. Tested on the site I was seeing the trouble and it seems to be working like a charm.
Comment #14
dwwBetter yet, named the function vertical_tabs_node_form_pre_render() for better namespace.
Comment #15
hefox CreditAttribution: hefox commentedPatch worked for me :)
Comment #16
dww;)
Comment #17
Dave ReidWill test out tonight and if it's indeed good will commit. Thanks everyone for testing so far.
Comment #18
Dave ReidComment #19
Dave ReidTested personally and works great. Fieldsets were re-ordered as expected and no side-effects! Committed to CVS (http://drupal.org/cvs?commit=285314). Thanks everyone!
Comment #20
jcmarco CreditAttribution: jcmarco commentedI found a collateral damage with this patch.
When you have cck_fieldgroup_tabs, before this patch, you were able to show the vertical tabs into the first tab with all the main content not in a defined fieldgroup tab ,
but now, the new #pre_render in vertical tabs (module weight:300) is executed after the #pre_render in cck_fieldgroup_tabs (module weigth:19) and it is not rendered before the cck_fieldgroup_tabs render the tabs.
Setting the vertical tabs module weight to 0 and this last #pre_render patch, the fields reordering in cck fields orders works fine even with the vertical tabs and the cck_fieldgroup_tabs render the vertical tabs correctly when it renders a tab.
Comment #21
apadernoI think the Vertical tabs weight has been raised to 300 because the module needs to be the last module to execute
hook_form_alter()
.Would not to increase the weight of cck_fieldgroup_tabs.module be possible without to have any collateral effects?
Comment #22
jcmarco CreditAttribution: jcmarco commentedIt sounds good! The result is the same.
Probably more modules that are using vertical tabs could be affected
if they are using #pre_render to render their content and vertical tabs.
Comment #23
realityloopyes it affects nodeformcols as well I can't get vertical tabs to display in the footer region of nodeformcols anymore
Comment #24
Dave ReidWhat is node_form_cols?
Comment #25
hefox CreditAttribution: hefox commentedhttp://drupal.org/project/nodeformcols
Comment #26
apadernoThe issue realityloop is referring to is #628192: Vertical Tabs & Vertical Tabs Default Tab compatibility - Can't move vertical tabs to footer area.
It's not clear why Vertical tabs output should be moved in the footer area. Considering that in the node edit form it contains fields for some node features, I don't see the purpose of moving them in an area that would have less visibility (if the footer area is the theme footer).
Comment #27
hefox CreditAttribution: hefox commentedBased on the description I would guess it's:
add ***
[ left column][right column]
[footer]
Not the actual drupal footer (that's theme dependent and doesn't need to exist, so would be problamic to use, specially for form submission).
I haven't used it before though.
I'm not the maintier or anything of .. anything, but here's my thoughts on the issue:
Perhaps one of the issues is that vertical columns does not create an order-able entry in the Manage forum and cck settings (at least I haven't seen an entry there for it)? However, other items do make those entries in that (which become under vertical tabs) so it gets complicated. Also, that won't solve the issue since/if nodeformcols does it's actions in form_alter since the vertical tab column doesn't exist yet now ( http://drupalcode.org/viewvc/drupal/contributions/modules/nodeformcols/n... ). My guess is that nodeformcol completely takes over from cck (for ordering, etc.) considering it creates the three 'regions' so perhaps the solution would reside in nodeformcol? There's already an issue created there ( #628192: Vertical Tabs & Vertical Tabs Default Tab compatibility - Can't move vertical tabs to footer area by realityloop ).
Comment #28
apadernoShould not Node form columns use
hook_theme_registry_alter()
to modify the theme data?I have misunderstood which footer area the issue was referring to. It's correct to say that it was the footer area that the modules adds to the page.
Comment #29
realityloophefox has hit the nail on the head for what I was trying to explain:
vertical columns does not create an order-able entry in the Manage form and cck settings
Comment #30
Dave ReidI'm guessing these two modules are just going to be incompatible. Please file a new issue since this does not relate to the original issue.
Comment #31
mrfelton CreditAttribution: mrfelton commentedDo we have a new issue for the nodeformcols incompatibility issue? I couldn't find one, but the problem is affecting me too so I'd like to join in the discussion about that.
Comment #32
Dave ReidYou can create a new issue, but I don't anything can be done. Like I said, I think these modules are just going to be incompatible. You're more than welcome to do more looking into it and prove me wrong. :)
Comment #33
mrfelton CreditAttribution: mrfelton commentedOk, moving the discussion over to the nodeformcols issue queue. I made a very quick hack to the module to get the vertical tabs to appear where I want them (in the nodeformcols footer region). Needs work, but I think the two modules can work together.
http://drupal.org/node/628192#comment-2343836