public function ModalPageSettingsForm::buildForm in Modal 8
Same name and namespace in other branches
- 8.3 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.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 32
Class
- ModalPageSettingsForm
- Form for configure messages.
Namespace
Drupal\modal_page\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('modal_page.settings');
$form['modals_by_page'] = [
'#type' => 'details',
'#title' => $this
->t('Modals by page'),
'#open' => TRUE,
];
$form['modals_by_page']['modal_page_modals'] = [
'#title' => $this
->t('Modals settings'),
'#type' => 'textarea',
'#description' => $this
->t('Insert values with format: <br><br><b>Page|Title|Text|Button|Text for "Do Not Show Again" (Optional)</b> <front> is the front page. <br><br> e.g. <b>Home|Welcome|Welcome to our new website|Thanks|Do not show again</b>'),
'#default_value' => $config
->get('modals'),
];
$form['modals_by_parameter'] = [
'#type' => 'details',
'#title' => $this
->t('Modals by parameter'),
'#open' => TRUE,
];
$form['modals_by_parameter']['modal_page_modals_by_parameter'] = [
'#title' => $this
->t('Modals by settings (By parameter)'),
'#type' => 'textarea',
'#description' => $this
->t('Insert values with format: <br><br><b>parameter=value|Title|Text|Button|Text for "Do Not Show Again" (Optional)</b>. <br><br> e.g. <b>visitor=welcome|Welcome|Welcome to our new website|Thanks|Do not show again</b>'),
'#default_value' => $config
->get('modals_by_parameter'),
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Submit'),
];
return $form;
}