You are here

public function ModalPageSettingsForm::buildForm in Modal 5.0.x

Same name and namespace in other branches
  1. 8.3 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
  2. 8 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
  3. 8.2 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
  4. 4.0.x src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::buildForm()
  5. 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\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $this
    ->setMessagesInfo();
  $config = $this
    ->config('modal_page.settings');
  $form['no_modal_page_external_js'] = [
    '#title' => $this
      ->t("Don't load external JS Bootstrap (bootstrap.min.js)"),
    '#type' => 'checkbox',
    '#description' => $this
      ->t('Just check if the js bootstrap (bootstrap.min.js) is already loaded elsewhere.'),
    '#default_value' => $config
      ->get('no_modal_page_external_js'),
  ];
  $form['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['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Submit'),
  ];
  return $form;
}