[development] hook_form_alter() node_type_form validation and persistence

Eric Schaefer eric.schaefer at eas-consulting.de
Wed Oct 6 17:27:29 UTC 2010

Hi List!

Maybe I just can't see the forest for the trees:

In scheduler.module (http://drupal.org/project/scheduler) in
scheduler_form_alter() the following code can be found (D6):

  if ('node_type_form' == $form_id) {
    $form['workflow']['scheduler'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable scheduled (un)publishing'),
      '#default_value' => variable_get('scheduler_'.
$form['#node_type']->type, 0),
      '#description' => t('Check this box to enable scheduled
(un)publishing for this node type.')
    $form['workflow']['scheduler_touch'] = array(
      '#type' => 'checkbox',
      '#title' => t('Alter published on time'),
      '#default_value' => variable_get('scheduler_touch_'.
$form['#node_type']->type, 0),
      '#description' => t('Check this box to alter the published on
time to match the scheduled time ("touch feature").')

I am trying to understand this. I can't figure out how the values of
the two checkboxes get validated and persisted back to
"scheduler_story" and "scheduler_touch_story". Is there some magic
involved that guesses the variable names from $form['workflow']?
How would I add my own fieldset?


More information about the development mailing list