diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-22 03:13:01 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-22 03:13:01 +0000 |
commit | 490fd34fb046163ab46084c3663e23606dfe46d1 (patch) | |
tree | 9f727dbd0d0aac4de38bb4de9d2cce05c8bd8b17 /modules/field_ui/field_ui.module | |
parent | eafe025efea0fc3f27cdb897669a1e65b75eb84e (diff) | |
download | brdo-490fd34fb046163ab46084c3663e23606dfe46d1.tar.gz brdo-490fd34fb046163ab46084c3663e23606dfe46d1.tar.bz2 |
#617632 by zserno, rszrama, and sign: Add a Save & Add Fields button when adding a content type.
Diffstat (limited to 'modules/field_ui/field_ui.module')
-rw-r--r-- | modules/field_ui/field_ui.module | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module index 5d11c6ee3..6d75f281b 100644 --- a/modules/field_ui/field_ui.module +++ b/modules/field_ui/field_ui.module @@ -305,3 +305,28 @@ function field_ui_inactive_instances($obj_type, $bundle_name = NULL) { } return $inactive; } + +/** + * Add a button Save and add fields to Create content type form. + */ +function field_ui_form_node_type_form_alter(&$form, $form_state) { + // We want to display the button only on add page. + if (empty($form['#node_type']->type)) { + $form['save_continue'] = array( + '#type' => 'submit', + '#value' => t('Save and add fields'), + '#weight' => 45, + ); + $form['#submit'][] = 'field_ui_form_node_type_form_submit'; + } +} + +/** + * Redirect to manage fields form. + */ +function field_ui_form_node_type_form_submit($form, &$form_state) { + if ($form_state['clicked_button']['#parents'][0] === 'save_continue') { + $form_state['redirect'] = 'admin/structure/types/manage/'. $form_state['values']['type'] .'/fields'; + } +} + |