You are here

public function ExpenseForm::buildForm in Drupal PM (Project Management) 4.x

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

modules/pm_expense/src/Form/ExpenseForm.php, line 36

Class

ExpenseForm
Form controller for Expense edit forms.

Namespace

Drupal\pm_expense\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\pm_expense\Entity\Expense $entity */
  $form = parent::buildForm($form, $form_state);
  if (!$this->entity
    ->isNew()) {
    $form['new_revision'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Create new revision'),
      '#default_value' => FALSE,
      '#weight' => 10,
    ];
  }
  return $form;
}