I'm extremely new to Drupal so if my question is badly worded I'm sorry. Inside my menu_ui_override.module I have made a made a new field and added a custom submit handler:

function menu_ui_override_form_menu_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['menu_header'] = array(
    '#type' => 'textfield',
    '#title' => t('Menu header'),
    '#weight' => '0',
    '#required' => FALSE,

  $form['actions']['submit']['#submit'][] = 'menu_ui_override_accept_menu_header_submit';

function menu_ui_override_accept_menu_header_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $values = array(
        'menu_header' => $form_state->getValue('menu_header'),
  $connection = \Drupal::database();

    'menu_header' => $values['menu_header'],

This seems to save my new field but now I'm not sure how to load the data entered into that field when I go back to edit the menu after saving it. I'm also not sure where to put the logic for this part. Any help would be greatly appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.