Closed (fixed)
Project:
Examples for Developers
Version:
7.x-1.x-dev
Component:
Vertical Tabs Example
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
5 Jan 2011 at 22:54 UTC
Updated:
14 Sep 2012 at 18:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidWell, Vertical Tabs are useless without tab summaries.
Comment #2
joachim commentedI think it depends on the form -- if it's an action rather than an edit, then all the vertical tabs are empty to begin with. Granted it's nice to be able to see what you've edited, but collapsible fieldsets don't show you that either.
It would be nice then if we have an example of vertical tabs in a form from scratch, as well as for a form alteration.
I've just managed to get them to work by cribbing core user settings form, and it is as simple as adding the (slightly fiddly -- see #1016912: vertical tabs don't work if deeper in the form array, #1016918: Vertical tabs should use common renderable structures, not extra #group property) vertical tabs element.
Comment #3
andrewmacpherson commented@1 - I disagree that vertical tabs are useless without summaries. For tabs that contain a lot of information it's not always practical. The user account notification emails at admin/config/people/accounts are a good example.
Comment #4
ilo commentedSo is the discussion about making vertical tabs 'look and feelt' fieldsets? in the end it is about usability, so it make sense to have empty tabs without all that code.
What bout just stating what are the form elements form in the example? in the end, only 'group' attribute is required to have a fieldset included in the vertical tab element, and for this I guess there is no need to create additional code.
Comment #5
joachim commentedI think we need to add an example that's a fresh form rather than hook_form_altering an existing one.
Comment #6
ilo commentedYes joachim, definitelly there are a lot of things missing in the example module.
I'd say that documentation page is very clear about how to create a form with vertical tabs enabled, clear enough for everybody to understand, and on the other hand, vertical tabs D7 code requires pretty much phpDoc work.
Creating just a form for this requires a menu entry, a form page and too much code not related to 'vertical tabs' at all, that IMO we don't need if we point to the http://drupal.org/handbook/modules/vertical-tabs documentation page using good comments on code.
As I'll be doing the phpDoc rewrite for this module, please, comment on any ideas about this. In the end I think that I'd be adding some more code, it does not take that much to add a form.
Comment #7
joachim commentedThat page doesn't look write for D7 at all.
I got them to work like this:
-- which to me seems rather incongruous with the general way that forms work -- that is, you normally nest form arrays for things to go within other things; here you don't.
Comment #8
ilo commentedReally? I was able to create vtabs this way in its simplest way:
Comment #9
joachim commentedOh yes that works.
In which case, the code in core I took my example from could do to be simplified!
Comment #10
dave reidComment #11
Anonymous (not verified) commentedI don't know whether this addition clarifies the point. It also uses required twice.
Don't need to say that this is the most common usage.
I would suggest something like "Vertical tabs are most usable when they include a summary of the fieldset values. This JavaScript file updates the 'summary' property of the tab."
Shouldn't comments within function bodies always use C++ style, ie "//"? I would change wording to "The form elements below provide a demonstration of how a fieldset summary can be displayed in a collapsed tab."
Powered by Dreditor.
Comment #12
deviantintegral commentedHere's a patch that rewords and cleans up the docs based on the feedback from #11.
Comment #13
deviantintegral commentedComment #14
mile23Applied the patch, expanded a few comments, added clearer language to the page at examples/vertical_tabs, gave our tab a very light weight so it's more obvious, and gave the textfield a default value.
Thanks everyone. :-)
Committed: http://drupalcode.org/project/examples.git/commitdiff/2b8f0a5908533d857a...
Comment #15
mile23