public function OrderStatusAddForm::validateForm in Ubercart 8.4
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
- uc_order/
src/ Form/ OrderStatusAddForm.php, line 76
Class
- OrderStatusAddForm
- Presents the form to create a custom order status.
Namespace
Drupal\uc_order\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$id = strtolower(trim($form_state
->getValue('id')));
if (strpos($id, ' ') !== FALSE || $id == 'all') {
$form_state
->setErrorByName('id', $this
->t('You have entered an invalid status ID.'));
}
if (OrderStatus::load($id)) {
$form_state
->setErrorByName('id', $this
->t('This ID is already in use. Please specify a unique ID.'));
}
}