public function ContactTypeForm::form in RedHen CRM 8
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- modules/
redhen_contact/ src/ Form/ ContactTypeForm.php, line 18
Class
- ContactTypeForm
- Class ContactTypeForm.
Namespace
Drupal\redhen_contact\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$redhen_contact_type = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $redhen_contact_type
->label(),
'#description' => $this
->t("Label for the contact type."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $redhen_contact_type
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\redhen_contact\\Entity\\ContactType::load',
],
'#disabled' => !$redhen_contact_type
->isNew(),
];
/* You will need additional form elements for your custom properties. */
return $form;
}