3 namespace Drupal\form_test\Form;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Builds a simple form that redirects on submit.
13 * @see \Drupal\form_test\Plugin\Block\RedirectFormBlock
15 class RedirectBlockForm extends FormBase {
20 public function getFormId() {
21 return 'redirect_block_form';
27 public function buildForm(array $form, FormStateInterface $form_state) {
28 $form['actions'] = ['#type' => 'actions'];
29 $form['actions']['submit'] = ['#type' => 'submit', '#value' => $this->t('Submit')];
37 public function submitForm(array &$form, FormStateInterface $form_state) {
38 $form_state->setRedirect('form_test.route1', [], ['query' => ['test1' => 'test2']]);