public function ReceiveCheckForm::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
- payment/
uc_payment_pack/ src/ Form/ ReceiveCheckForm.php, line 65
Class
- ReceiveCheckForm
- Form for recording a received check and expected clearance date.
Namespace
Drupal\uc_payment_pack\FormCode
public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $uc_order = NULL) {
$balance = uc_payment_balance($uc_order);
$form['balance'] = [
'#prefix' => '<strong>' . $this
->t('Order balance:') . '</strong> ',
'#markup' => uc_currency_format($balance),
];
$form['order_id'] = [
'#type' => 'hidden',
'#value' => $uc_order
->id(),
];
$form['amount'] = [
'#type' => 'uc_price',
'#title' => $this
->t('Check amount'),
'#default_value' => $balance,
];
$form['comment'] = [
'#type' => 'textfield',
'#title' => $this
->t('Comment'),
'#description' => $this
->t('Any notes about the check, like type or check number.'),
'#size' => 64,
'#maxlength' => 256,
];
$form['clear_date'] = [
'#type' => 'datetime',
'#title' => $this
->t('Expected clear date'),
'#date_date_element' => 'date',
'#date_time_element' => 'none',
'#default_value' => DrupalDateTime::createFromTimestamp($this->time
->getRequestTime()),
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Receive check'),
];
return $form;
}