public function DateFormatFormBase::validateForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::validateForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
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;
}
}
}