public function ReceiveCheckForm::submitForm in Ubercart 8.4
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- payment/
uc_payment_pack/ src/ Form/ ReceiveCheckForm.php, line 107
Class
- ReceiveCheckForm
- Form for recording a received check and expected clearance date.
Namespace
Drupal\uc_payment_pack\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
uc_payment_enter($form_state
->getValue('order_id'), 'check', $form_state
->getValue('amount'), $this
->currentUser()
->id(), NULL, $form_state
->getValue('comment'));
$clear_date = $form_state
->getValue('clear_date')
->getTimestamp();
\Drupal::database()
->insert('uc_payment_check')
->fields([
'order_id' => $form_state
->getValue('order_id'),
'clear_date' => $clear_date,
])
->execute();
$this
->messenger()
->addMessage($this
->t('Check received, expected clear date of @date.', [
'@date' => $this->dateFormatter
->format($clear_date, 'uc_store'),
]));
$form_state
->setRedirect('entity.uc_order.canonical', [
'uc_order' => $form_state
->getValue('order_id'),
]);
}