You are here

public function WishlistEmailForm::submitForm in UC Wish List 8

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

src/Form/WishlistEmailForm.php, line 77

Class

WishlistEmailForm

Namespace

Drupal\uc_wishlist\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  /**$emails = explode(',', $form_state->getValue['recipients']);
     $emails = array_filter($emails);
     // Getting subject of the mail and its sanitization.
     $subject = Html::escape($form_state->getValue['subject']);
     // Getting message of the mail and text sanitization.
     $message = check_markup($form_state->getValue['message']);
     $wid = $form_state->getValue['id'];
     $message = $message . "\n" . l(t('Wishlist'), 'wishlist/' . $wid);
     foreach ($emails as $email) {
     uc_wishlist_send_mail($email, $subject, $message);
     }*/
  drupal_set_message($this
    ->t('Your wishlist has been emailed!', [
    'recipients' => $form_state
      ->getValue('recipients'),
  ]));
  $form_state
    ->setRedirect('uc_wishlist.wishlist.email_form');
}