You are here

public function MailInvoiceForm::buildForm in Ubercart 8.4

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 FormInterface::buildForm

File

uc_order/src/Form/MailInvoiceForm.php, line 59

Class

MailInvoiceForm
Defines a form to set the recipient of an invoice, then mails it.

Namespace

Drupal\uc_order\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $uc_order = NULL) {
  $this->order = $uc_order;
  $form['email'] = [
    '#type' => 'email',
    '#title' => $this
      ->t('Recipient e-mail address'),
    '#default_value' => $uc_order
      ->getEmail(),
    '#required' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Mail invoice'),
  ];
  return $form;
}