function DateFormatFormBase::validateForm
Same name in other branches
- 8.9.x core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::validateForm()
- 10 core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::validateForm()
- 11.x core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::validateForm()
Overrides FormBase::validateForm
File
-
core/
modules/ system/ src/ Form/ DateFormatFormBase.php, line 121
Class
- DateFormatFormBase
- Provides a base form for date formats.
Namespace
Drupal\system\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// The machine name field should already check to see if the requested
// machine name is available.
$pattern = trim($form_state->getValue('date_format_pattern'));
foreach ($this->dateFormatStorage
->loadMultiple() as $format) {
if ($format->getPattern() == $pattern && $format->id() == $this->entity
->id()) {
$this->messenger()
->addStatus($this->t('The existing format/name combination has not been altered.'));
continue;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.