public function CurrencyLocaleForm::validateForm in Currency 8.3
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
- src/
Entity/ CurrencyLocale/ CurrencyLocaleForm.php, line 145
Class
- CurrencyLocaleForm
- Provides a currency_locale add/edit form.
Namespace
Drupal\currency\Entity\CurrencyLocaleCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$currency_locale = $this
->getEntity();
if ($currency_locale
->isNew()) {
$values = $form_state
->getValues();
$locale = strtolower($values['language_code']) . '_' . strtoupper($values['country_code']);
$loaded_currency_locale = $this->currencyLocaleStorage
->load($locale);
if ($loaded_currency_locale) {
$form_state
->setError($form['locale'], $this
->t('A pattern for this locale already exists.'));
}
}
}