1.20.x field_ui.module field_ui_form_node_type_form_alter(&$form, $form_state)

Implements hook_form_FORM_ID_alter().

Adds a button 'Save and add fields' to the 'Add content type' form.

See also

node_type_form()

field_ui_form_node_type_form_submit()

File

modules/field_ui/field_ui.module, line 379
Allows administrators to attach custom fields to fieldable types.

Code

function field_ui_form_node_type_form_alter(&$form, $form_state) {
  // Display the button only on the 'Add content type' page.
  if (empty($form['#node_type']->type)) {
    $form['actions']['save_continue'] = array(
      '#type' => 'submit',
      '#value' => t('Save and add fields'),
      '#weight' => 35,
    );
    $form['#submit'][] = 'field_ui_form_node_type_form_submit';
  }
}