[development] hook_form_alter() node_type_form validation and persistence

Eric Schaefer eric.schaefer at eas-consulting.de
Wed Oct 6 19:02:20 UTC 2010


2010/10/6 Steve Ringwood <nevets at tds.net>:
>     The 'scheduler' comes from the form element name
> ($form['workflow']['scheduler'])
>
>     You can add new elements to existing field sets or add your own field
> set.

Thats what I guessed. Thats why I tried this:


    $form['scheduler'] = array(
      '#type' => 'fieldset',
      '#title' => 'Scheduler settings',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 35,
      '#group' => 'additional_settings',
    );

    $form['scheduler']['publish'] = array(
      '#type' => 'fieldset',
      '#title' => 'Publishing settings',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 1,
      '#group' => 'additional_settings',
    );
    $form['scheduler']['publish']['enable'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable scheduled publishing'),
      '#default_value' => variable_get('scheduler_publish_enable_'.
$form['#node_type']->type, 0),
      '#description' => t('Check this box to enable scheduled
publishing for this node type.')
    );
    $form['scheduler']['publish']['touch'] = array(
      '#type' => 'checkbox',
      '#title' => t('Alter published on time'),
      '#default_value' => variable_get('scheduler_publish_touch_'.
$form['#node_type']->type, 0),
      '#description' => t('Check this box to alter the published on
time to match the scheduled time ("touch feature").')
    );

There is supposed to be a "scheduler" fieldset and a "publish"
fieldset inside it. Inside the latter are two checkboxes. The form
gets created alright but the variables don't get set. What am I doing
wrong?

Thanks,
Eric


More information about the development mailing list