function MenuLinkEditForm::submitForm

Same name in other branches
  1. 8.9.x core/modules/menu_ui/src/Form/MenuLinkEditForm.php \Drupal\menu_ui\Form\MenuLinkEditForm::submitForm()
  2. 10 core/modules/menu_ui/src/Form/MenuLinkEditForm.php \Drupal\menu_ui\Form\MenuLinkEditForm::submitForm()
  3. 11.x core/modules/menu_ui/src/Form/MenuLinkEditForm.php \Drupal\menu_ui\Form\MenuLinkEditForm::submitForm()

Overrides FormInterface::submitForm

File

core/modules/menu_ui/src/Form/MenuLinkEditForm.php, line 95

Class

MenuLinkEditForm
Defines a generic edit form for all menu link plugin types.

Namespace

Drupal\menu_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $link = $form['#plugin_form']->submitConfigurationForm($form, $form_state);
    $this->messenger()
        ->addStatus($this->t('The menu link has been saved.'));
    $form_state->setRedirect('entity.menu.edit_form', [
        'menu' => $link->getMenuName(),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.