You are here

public function MerciLineItemTypeForm::form in MERCI (Manage Equipment Reservations, Checkout and Inventory) 8.2

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/merci_line_item/src/Form/MerciLineItemTypeForm.php, line 18

Class

MerciLineItemTypeForm
Class MerciLineItemTypeForm.

Namespace

Drupal\merci_line_item\Form

Code

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

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