RedirectBlockForm.php in Zircon Profile 8
Same filename and directory in other branches
Contains \Drupal\form_test\Form\RedirectBlockForm.
Namespace
Drupal\form_test\FormFile
core/modules/system/tests/modules/form_test/src/Form/RedirectBlockForm.phpView source
<?php
/**
* @file
* Contains \Drupal\form_test\Form\RedirectBlockForm.
*/
namespace Drupal\form_test\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Builds a simple form that redirects on submit.
*
* @see \Drupal\form_test\Plugin\Block\RedirectFormBlock
*/
class RedirectBlockForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'redirect_block_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this
->t('Submit'),
);
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state
->setRedirect('form_test.route1', array(), array(
'query' => array(
'test1' => 'test2',
),
));
}
}
Classes
Name![]() |
Description |
---|---|
RedirectBlockForm | Builds a simple form that redirects on submit. |