You are here

public function OrgTypeForm::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_org/src/Form/OrgTypeForm.php, line 17

Class

OrgTypeForm
Class OrgTypeForm.

Namespace

Drupal\redhen_org\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $redhen_org_type = $this->entity;
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $redhen_org_type
      ->label(),
    '#description' => $this
      ->t("Label for the org type."),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $redhen_org_type
      ->id(),
    '#machine_name' => [
      'exists' => '\\Drupal\\redhen_org\\Entity\\OrgType::load',
    ],
    '#disabled' => !$redhen_org_type
      ->isNew(),
  ];

  /* You will need additional form elements for your custom properties. */
  return $form;
}