public function NoscriptTagSettingsForm::buildForm in Noscript Tag 8
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/ NoscriptTagSettingsForm.php, line 34
Class
- NoscriptTagSettingsForm
- Class NoscriptTagSettingsForm.
Namespace
Drupal\noscript_tag\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Get the config for module.
$config = $this
->config('noscript_tag.settings');
// Form builder.
$form = [];
$form = [
'noscript_tag_value' => [
'#type' => 'text_format',
'#title' => $this
->t('Enter message to display in noscript tag:'),
'#description' => $this
->t('Please enter your message which you want to display users that have disabled scripts in their browser or have a browser that does not support script tag.'),
'#default_value' => $config
->get('noscript_tag_value') ? $config
->get('noscript_tag_value') : $this
->t('Your browser does not support javascript!'),
'#format' => $config
->get('noscript_tag_format') ? $config
->get('noscript_tag_format') : 'basic_html',
'#rows' => 5,
'#cols' => 10,
'#resizable' => TRUE,
],
];
// Return the form.
return parent::buildForm($form, $form_state);
}