function FieldConfigEditForm::save

Same name in other branches
  1. 9 core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::save()
  2. 10 core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::save()
  3. 11.x core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::save()

Overrides EntityForm::save

File

core/modules/field_ui/src/Form/FieldConfigEditForm.php, line 206

Class

FieldConfigEditForm
Provides a form for the field settings form.

Namespace

Drupal\field_ui\Form

Code

public function save(array $form, FormStateInterface $form_state) {
    $this->entity
        ->save();
    $this->messenger()
        ->addStatus($this->t('Saved %label configuration.', [
        '%label' => $this->entity
            ->getLabel(),
    ]));
    $request = $this->getRequest();
    if (($destinations = $request->query
        ->get('destinations')) && ($next_destination = FieldUI::getNextDestination($destinations))) {
        $request->query
            ->remove('destinations');
        $form_state->setRedirectUrl($next_destination);
    }
    else {
        $form_state->setRedirectUrl(FieldUI::getOverviewRouteInfo($this->entity
            ->getTargetEntityTypeId(), $this->entity
            ->getTargetBundle()));
    }
}

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