public function IndividualTypeForm::validate in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_contact/src/Form/IndividualTypeForm.php \Drupal\crm_core_contact\Form\IndividualTypeForm::validate()
- 8.2 modules/crm_core_contact/src/Form/IndividualTypeForm.php \Drupal\crm_core_contact\Form\IndividualTypeForm::validate()
File
- modules/
crm_core_contact/ src/ Form/ IndividualTypeForm.php, line 102
Class
- IndividualTypeForm
- Form for edit individual types.
Namespace
Drupal\crm_core_contact\FormCode
public function validate(array $form, FormStateInterface $form_state) {
parent::validate($form, $form_state);
$id = trim($form_state
->getValue('type'));
// '0' is invalid, since elsewhere we check it using empty().
if ($id == '0') {
$form_state
->setErrorByName('type', $this
->t("Invalid machine-readable name. Enter a name other than %invalid.", [
'%invalid' => $id,
]));
}
}