You are here

RedirectForm.php in Commerce Core 8.2

File

tests/modules/commerce_test/src/Form/RedirectForm.php
View source
<?php

namespace Drupal\commerce_test\Form;

use Drupal\commerce\Response\NeedsRedirectException;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Redirects the user to drupal.org.
 */
class RedirectForm extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'commerce_test_redirect_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    throw new NeedsRedirectException('https://www.example.org/');
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
  }

}

Classes

Namesort descending Description
RedirectForm Redirects the user to drupal.org.