Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / RedirectBlockForm.php
1 <?php
2
3 namespace Drupal\form_test\Form;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Builds a simple form that redirects on submit.
10  *
11  * @internal
12  *
13  * @see \Drupal\form_test\Plugin\Block\RedirectFormBlock
14  */
15 class RedirectBlockForm extends FormBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function getFormId() {
21     return 'redirect_block_form';
22   }
23
24   /**
25    * {@inheritdoc}
26    */
27   public function buildForm(array $form, FormStateInterface $form_state) {
28     $form['actions'] = ['#type' => 'actions'];
29     $form['actions']['submit'] = ['#type' => 'submit', '#value' => $this->t('Submit')];
30
31     return $form;
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function submitForm(array &$form, FormStateInterface $form_state) {
38     $form_state->setRedirect('form_test.route1', [], ['query' => ['test1' => 'test2']]);
39   }
40
41 }