RedirectForm.php in Commerce Core 8.2
Namespace
Drupal\commerce_test\FormFile
tests/modules/commerce_test/src/Form/RedirectForm.phpView 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
Name | Description |
---|---|
RedirectForm | Redirects the user to drupal.org. |