public function AnonymousRedirectSettingsForm::buildForm in Anonymous Redirect 8.2
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ AnonymousRedirectSettingsForm.php, line 34
Class
- AnonymousRedirectSettingsForm
- Configuration form for Anonymous Redirect.
Namespace
Drupal\anonymous_redirect\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('anonymous_redirect.settings');
$form['enable_anonymous_redirect'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable Anonymous Redirect'),
'#description' => $this
->t('turn on/off anonymous redirect'),
'#default_value' => $config
->get('enable_redirect'),
];
$form['redirect_base_url'] = [
'#type' => 'textfield',
'#title' => $this
->t('Redirect Base URL'),
'#description' => $this
->t("For internal URL's use <front> or '/path'. For external ULR's user http:// and No trailing slash. For example, http://example.com or http://example.com/drupal."),
'#maxlength' => 500,
'#size' => 64,
"#default_value" => $config
->get('redirect_url'),
];
$form['redirect_url_overrides'] = [
'#type' => 'textarea',
'#title' => $this
->t('Redirect URL Overrides'),
'#description' => $this
->t("A list of internal paths to ignore the redirect for. One path per line. (eg. '/path')"),
'#rows' => 4,
'#default_value' => $config
->get('redirect_url_overrides'),
];
return parent::buildForm($form, $form_state);
}