#617632 by zserno, rszrama, and sign: Add a Save & Add Fields button when adding a content type.
parent
eafe025efe
commit
490fd34fb0
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue