public function MailInvoiceForm::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
- uc_order/
src/ Form/ MailInvoiceForm.php, line 80
Class
- MailInvoiceForm
- Defines a form to set the recipient of an invoice, then mails it.
Namespace
Drupal\uc_order\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$recipient = $form_state
->getValue('email');
$params = [
'order' => $this->order,
];
$this->mailManager
->mail('uc_order', 'invoice', $recipient, uc_store_mail_recipient_langcode($recipient), $params, uc_store_email_from());
$message = $this
->t('Invoice e-mailed to @email.', [
'@email' => $recipient,
]);
$this
->messenger()
->addMessage($message);
$this->order
->logChanges([
$message,
]);
}