public DateFormatFormBase::validateForm(array &$form, FormStateInterface $form_state)
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 124
Class
- DateFormatFormBase
- Provides a base form for date formats.
Namespace
Drupal\system\Form
Code
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())) {
drupal_set_message(t('The existing format/name combination has not been altered.'));
continue;
}
}
}
Please login to continue.