public function ModalPageSettingsForm::buildForm in Modal 4.0.x
Same name and namespace in other branches
- 8.3 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
- 8 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
- 8.2 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
- 5.0.x src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
- 4.1.x src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
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/ ModalPageSettingsForm.php, line 68
Class
- ModalPageSettingsForm
- Form for configure messages.
Namespace
Drupal\modal_page\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this
->setMessagesInfo();
$config = $this
->config('modal_page.settings');
$form['global_settings'] = [
'#type' => 'details',
'#title' => $this
->t('Global Settings'),
'#open' => TRUE,
];
$form['global_settings']['bootstrap'] = [
'#type' => 'details',
'#title' => $this
->t('Bootstrap'),
'#open' => TRUE,
];
$form['global_settings']['bootstrap']['verify_load_bootstrap_automatically'] = [
'#title' => $this
->t("Verify and Load Bootstrap automatically if necessary (Recommended)"),
'#type' => 'checkbox',
'#description' => $this
->t("It will verify and load bootstrap.min.js only if you don't have it loaded yet."),
'#default_value' => $config
->get('verify_load_bootstrap_automatically'),
];
$form['global_settings']['bootstrap']['load_bootstrap'] = [
'#title' => $this
->t("Load Bootstrap with Modal Page"),
'#type' => 'checkbox',
'#description' => $this
->t('It will load bootstrap.min.js. If you already have it loaded in other place you can disable this option.'),
'#default_value' => $config
->get('load_bootstrap'),
'#states' => [
'disabled' => [
':input[name="verify_load_bootstrap_automatically"]' => [
'checked' => TRUE,
],
],
],
];
$form['global_settings']['html_tags'] = [
'#type' => 'details',
'#title' => $this
->t('HTML Tags'),
'#open' => TRUE,
];
$form['global_settings']['html_tags']['allowed_tags'] = [
'#type' => 'textarea',
'#title' => $this
->t('Allowed Tags'),
'#description' => $this
->t("A list of HTML tags that can be used, separated by commas(,)."),
'#default_value' => $config
->get('allowed_tags') ?? "h1,h2,a,b,big,code,del,em,i,ins,pre,q,small,span,strong,sub,sup,tt,ol,ul,li,p,br,img",
];
$form['global_settings']['performance'] = [
'#type' => 'details',
'#title' => $this
->t('Performance'),
'#open' => TRUE,
];
$form['global_settings']['performance']['clear_caches_on_modal_save'] = [
'#title' => $this
->t("Clear caches when save Modal"),
'#type' => 'checkbox',
'#default_value' => $config
->get('clear_caches_on_modal_save'),
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Submit'),
];
return $form;
}