function field_ui_form_node_type_form_alter
Same name in other branches
- 7.x modules/field_ui/field_ui.module \field_ui_form_node_type_form_alter()
- 8.9.x core/modules/field_ui/field_ui.module \field_ui_form_node_type_form_alter()
Implements hook_form_FORM_ID_alter().
Adds a button 'Save and manage fields' to the 'Create content type' form.
See also
field_ui_form_node_type_form_submit()
File
-
core/
modules/ field_ui/ field_ui.module, line 125
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.