public function TransactionTypeFormBase::validateForm in Transaction 8
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/
Form/ TransactionTypeFormBase.php, line 172
Class
- TransactionTypeFormBase
- Base form for transaction type forms.
Namespace
Drupal\transaction\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
/** @var \Drupal\transaction\TransactionTypeInterface $transaction_type */
$transaction_type = $this->entity;
$id = trim($form_state
->getValue('id'));
// '0' is invalid, to safe empty check.
if ($id == '0') {
$form_state
->setErrorByName('id', $this
->t("Invalid machine-readable name. Enter a name other than %invalid.", [
'%invalid' => $id,
]));
}
$transaction_type
->getPlugin()
->validateConfigurationForm($form, $form_state);
}