field_ui_form_node_type_form_alter(&$form, FormStateInterface $form_state)
Implements hook_form_FORM_ID_alter().
Adds a button 'Save and manage fields' to the 'Create content type' form.
See also
node_type_form()
field_ui_form_node_type_form_submit()
File
- core/modules/field_ui/field_ui.module, line 125
- Allows administrators to attach custom fields to fieldable types.
Code
function field_ui_form_node_type_form_alter(&$form, FormStateInterface $form_state) { // We want to display the button only on add page. if ($form_state->getFormObject()->getEntity()->isNew()) { $form['actions']['save_continue'] = $form['actions']['submit']; $form['actions']['save_continue']['#value'] = t('Save and manage fields'); $form['actions']['save_continue']['#weight'] = $form['actions']['save_continue']['#weight'] + 5; $form['actions']['save_continue']['#submit'][] = 'field_ui_form_node_type_form_submit'; // Hide the 'Save content type' button. $form['actions']['submit']['#access'] = FALSE; } }
Please login to continue.