function FieldUiHooks::manageFieldFormSubmit

Same name and namespace in other branches
  1. 11.x core/modules/field_ui/src/Hook/FieldUiHooks.php \Drupal\field_ui\Hook\FieldUiHooks::manageFieldFormSubmit()

Form submission handler for the 'Save and manage fields' button.

See also

field_ui_form_alter()

File

core/modules/field_ui/src/Hook/FieldUiHooks.php, line 286

Class

FieldUiHooks
Hook implementations for field_ui.

Namespace

Drupal\field_ui\Hook

Code

public function manageFieldFormSubmit($form, FormStateInterface $form_state) : void {
  $provider = $form_state->getFormObject()
    ->getEntity()
    ->getEntityType()
    ->getProvider();
  $id = $form_state->getFormObject()
    ->getEntity()
    ->id();
  if ($form_state->getTriggeringElement()['#parents'][0] === 'save_continue' && $route_info = FieldUI::getOverviewRouteInfo($provider, $id)) {
    $form_state->setRedirectUrl($route_info);
  }
}

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