Moving Scheduler Module's 'Scheduling Options' Out of the Vertical Tabs in D7
This post is more than 10 years old. I do not delete posts, because even old information is still useful, but please know that some material on this page may be outdated or incorrect. Thanks!
...or, "Always Check Your Module Weights when form_alter'ing"

I spent about half an hour today trying to use hook_form_alter() to move the 'Scheduling options' fieldset (provided by the Scheduler module) out of my node form's vertical tabs (down where URL path settings, comment settings, etc. are jumbled together).
I couldn't even see the 'scheduler_settings' form settings when I looked at the form's array, even though I knew it existed (since it was being displayed, and the scheduler.module defined it using its own hook_form_alter().
After scratching my head and almost throwing in the towel, I finally noticed this thread, in which Dave Reid mentioned the priority and heirarchy of form_alter calls (hook_form_alter(), hook_form_BASE_FORM_ID_alter(), then finally hook_form_FORM_ID_alter()). Later in the thread, Dave also mentioned the fact that the module weights (in the system table) also affect the order in which forms are altered...
Since my custom.module was weighted the same as scheduler.module (both were '0'), scheduler.module ran later, so I couldn't see the field it added. I simply popped over to Sequel Pro, updated my custom.module's weight in the system table to 9 (don't ask), and voila! I could form_alter the 'Scheduling options' fieldset to my heart's content. To get it to appear above the vertical tabs in a node form, do something like the following in your custom.module:
<?php
/**
* Implements hook_form_FORM_ID_alter().
*/
function custom_form_note_node_form_alter(&$form, $form_state, $form_id) {
unset($form['scheduler_settings']['#group']);
}
?>
Comments