function DateFormatFormBase::save

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

Overrides EntityForm::save

File

core/modules/system/src/Form/DateFormatFormBase.php, line 146

Class

DateFormatFormBase
Provides a base form for date formats.

Namespace

Drupal\system\Form

Code

public function save(array $form, FormStateInterface $form_state) {
    $status = $this->entity
        ->save();
    if ($status == SAVED_UPDATED) {
        $this->messenger()
            ->addStatus($this->t('Custom date format updated.'));
    }
    else {
        $this->messenger()
            ->addStatus($this->t('Custom date format added.'));
    }
    $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.