Index: vertical_tabs.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/vertical_tabs/vertical_tabs.module,v retrieving revision 1.1.2.22 diff -u -p -r1.1.2.22 vertical_tabs.module --- vertical_tabs.module 22 Aug 2009 20:07:54 -0000 1.1.2.22 +++ vertical_tabs.module 1 Nov 2009 20:19:24 -0000 @@ -95,7 +95,7 @@ function vertical_tabs_add_vertical_tabs } /** - * Implementation of hook_form_alter. + * Implementation of hook_form_alter(). */ function vertical_tabs_form_alter(&$form, $form_state, $form_id) { // Check to see which form we are in. Since the node form's form id is not @@ -103,16 +103,7 @@ function vertical_tabs_form_alter(&$form // stuck implementing the global form_alter and checking if there is the // string node_form in the form id. if (preg_match('/_node_form$/', $form_id)) { - $node_type = $form['type']['#value']; - - // The $fieldsets array is a list of all supported fieldsets in core - // for the node form, and their JavaScript summary creators. - $fieldsets = vertical_tabs_fieldsets($node_type); - - if (vertical_tabs_add_vertical_tabs($form, $fieldsets)) { - drupal_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.node_form.js'); - $form['vertical_tabs']['#weight'] = 100; - } + $form['#pre_render'][] = 'vertical_tabs_node_form_pre_render'; } if ($form_id == 'node_type_form' && $form['#node_type']->type && !$form['#programmed']) { @@ -130,6 +121,24 @@ function vertical_tabs_form_alter(&$form } } +/** + * Pre-render function for the node form. + */ +function vertical_tabs_node_form_pre_render($form) { + $node_type = $form['type']['#value']; + + // The $fieldsets array is a list of all supported fieldsets in core + // for the node form, and their JavaScript summary creators. + $fieldsets = vertical_tabs_fieldsets($node_type); + + if (vertical_tabs_add_vertical_tabs($form, $fieldsets)) { + drupal_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.node_form.js'); + $form['vertical_tabs']['#weight'] = 100; + } + + return $form; +} + function vertical_tabs_node_type_form($node_type) { module_load_include('inc', 'node', 'node.pages');