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.
11 * @see \Drupal\form_test\Plugin\Block\RedirectFormBlock
13 class RedirectBlockForm extends FormBase {
18 public function getFormId() {
19 return 'redirect_block_form';
25 public function buildForm(array $form, FormStateInterface $form_state) {
26 $form['actions'] = ['#type' => 'actions'];
27 $form['actions']['submit'] = ['#type' => 'submit', '#value' => $this->t('Submit')];
35 public function submitForm(array &$form, FormStateInterface $form_state) {
36 $form_state->setRedirect('form_test.route1', [], ['query' => ['test1' => 'test2']]);