Commit 490fd34f authored by webchick's avatar webchick
Browse files

#617632 by zserno, rszrama, and sign: Add a Save & Add Fields button when adding a content type.

parent eafe025e
......@@ -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';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment