Please document how to vertical_tabs-ify a module in D6 (and compare to D7 core)
dww - August 19, 2009 - 22:33
| Project: | Vertical Tabs |
| Version: | 6.x-1.x-dev |
| Component: | Documentation |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I've been searching for docs on how to support vertical tabs for non-node forms in some modules I maintain in D6. Could be a nice UI for various things if vertical_tabs is enabled on the site. However, I can't find any such docs anywhere, and Dmitri said in IRC that such docs don't exist. Please add them. ;)
While you're at it, it'd be really nice to explain the differences between vtab-ifying a D6 module vs. D7 core vtabs support.
Thanks much!
-Derek

#1
I've been working on making this easier for sites to integrate with the D6 contrib vertical tabs. See #500044: Extend the support to different modules / form pages where all it would all you would basically need to do is run vertical_tabs_add_vertical_tabs($form).
#2
#3
Need to also document how to add your own module's summary support if your module adds a fieldset on the node add/edit form.
#4
Is the summary support also available for third-party module forms, or is it present just in the node edit form?
#5
Summary support is enabled for any type of form that has a vertical tab.
#6
Any ideas on which subpage we should start adding our documentation on in http://drupal.org/handbook/config/contribmodules ?
#7
This looks pretty appropriate...
Form and Interaction Modules
The following modules help users create content and provide input to your site.
#8
seems the more appropriate; is too generic, and vague for this module.
#9
Ok I'm going to roll a new beta release with all the recent commits and work on a full handbook page, then once that's finished, copy it into a README.txt.
#10
Subscribing, since my issue #476910: Compatibility with Modr8 module was marked "won't fix" on this. Has the new hook been added to a release yet?
#11
@EvanDonovan: Here's how I did it in XML sitemap's sub-module xmlsitemap_node:
<?php
function xmlsitemap_node_form_alter(&$form, $form_state, $form_id) {
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
$form['xmlsitemap'] = array(
'#type' => 'fieldset',
...
// Add the vertical tabs JavaScript.
if ($form['xmlsitemap']['#access'] && module_exists('vertical_tabs')) {
drupal_add_js(drupal_get_path('module', 'xmlsitemap_node') . '/xmlsitemap_node.vertical_tabs.node_form.js');
}
}
}
?>
Note that I do an additional check if the user has access to the xmlsitemap fieldset so I don't include the JS if it's not going to be used at all.
And this is my xmlsitemap_node.vertical_tabs.node_form.js file:
Drupal.verticalTabs = Drupal.verticalTabs || {};
Drupal.verticalTabs.xmlsitemap = function() {
var vals = [];
// Inclusion select field
var status = $('#edit-xmlsitemap-status').val();
var status_text = $("#edit-xmlsitemap-status option[value='" + status + "']").text();
vals.push(Drupal.t('Inclusion: @value', { '@value': status_text }));
// Priority select field
var priority = $('#edit-xmlsitemap-priority').val();
var priority_text = $("#edit-xmlsitemap-priority option[value='" + priority + "']").text();
vals.push(Drupal.t('Priority: @value', { '@value': priority_text }));
return vals.join('<br />');
}
#12
Cool, thanks. This should be fairly easy for me to replicate.