You are here

public function SubscriptionForm::cancelSubscription in Commerce Recurring Framework 8

Submit handler for canceling a subscription.

Parameters

array $form: The form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

File

src/Form/SubscriptionForm.php, line 210

Class

SubscriptionForm

Namespace

Drupal\commerce_recurring\Form

Code

public function cancelSubscription(array $form, FormStateInterface $form_state) {

  // Prevent ?destination from overriding our redirect.
  // @todo remove after https://www.drupal.org/project/drupal/issues/2950883
  $this
    ->getRequest()->query
    ->remove('destination');
  $form_state
    ->setRedirect('entity.commerce_subscription.cancel_form', [
    'commerce_subscription' => $this->entity
      ->id(),
  ]);
}