function EntityDisplayModeFormBase::save

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

Overrides EntityForm::save

File

core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php, line 80

Class

EntityDisplayModeFormBase
Provides the generic base class for entity display mode forms.

Namespace

Drupal\field_ui\Form

Code

public function save(array $form, FormStateInterface $form_state) {
    $this->messenger()
        ->addStatus($this->t('Saved the %label @entity-type.', [
        '%label' => $this->entity
            ->label(),
        '@entity-type' => $this->entityType
            ->getSingularLabel(),
    ]));
    $this->entity
        ->save();
    \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
    $form_state->setRedirectUrl($this->entity
        ->toUrl('collection'));
}

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