public function OrganizationTypeForm::validateForm in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_contact/src/Form/OrganizationTypeForm.php \Drupal\crm_core_contact\Form\OrganizationTypeForm::validateForm()
- 8.2 modules/crm_core_contact/src/Form/OrganizationTypeForm.php \Drupal\crm_core_contact\Form\OrganizationTypeForm::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
- modules/
crm_core_contact/ src/ Form/ OrganizationTypeForm.php, line 106
Class
- OrganizationTypeForm
- Class OrganizationTypeForm.
Namespace
Drupal\crm_core_contact\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$id = trim($form_state
->getValue('id'));
// '0' is invalid, since elsewhere we check it using empty().
if ($id == '0') {
$form_state
->setErrorByName('id', $this
->t("Invalid machine-readable name. Enter a name other than %invalid.", [
'%invalid' => $id,
]));
}
}