'book', 'revision_information' => 'revision', 'author' => 'authoring', 'options' => 'publishingOptions', 'menu' => 'menu', 'comment_settings' => 'comment', 'path' => 'path', 'attachments' => 'attachments', ); // The javascript to add to the page. $javascript = array(); // Store the greatest weight so we can know how low to move the buttons. $greatest_weight = 0; // Iterate through the form, finding fieldsets. foreach (element_children($form) as $key) { // We need to make sure that the element we have is a fieldset. if ($form[$key]['#type'] == 'fieldset') { // Assign the weight. $form[$key]['#weight'] = ($form[$key]['#weight'] ? $form[$key]['#weight'] + 1000000 : 1000000); // Determine the greatest weight. $greatest_weight = max($greatest_weight, $form[$key]['#weight']); // Add the JavaScript. $javascript[$key] = array('name' => $form[$key]['#title']); // If there's a summary callback, then add it. if (isset($form[$key]['#summary_callback']) || isset($fieldsets[$key])) { $javascript[$key]['callback'] = (isset($form[$key]['#summary_callback']) ? $form[$key]['#summary_callback'] : $fieldsets[$key]); $javascript[$key]['args'] = (isset($form[$key]['#summary_arguments']) ? $form[$key]['#summary_arguments'] : array()); } // Add a class to identify the fieldset. if (isset($form[$key]['#attributes']['class']) && !empty($form[$key]['#attributes']['class'])) { $form[$key]['#attributes']['class'] .= ' vertical-tabs-fieldset vertical-tabs-'. $key; } else { $form[$key]['#attributes']['class'] = 'vertical-tabs-fieldset vertical-tabs-'. $key; } } } // Move the buttons, and add a