public function SettingsForm::buildForm in jQuery form styler 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/ SettingsForm.php, line 36 - Contains \Drupal\form_styler\Form\SettingsForm.
Class
Namespace
Drupal\form_styler\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('form_styler.settings');
$form['form_ids'] = [
'#type' => 'textarea',
'#title' => $this
->t('Form ids'),
'#description' => $this
->t('Specify the id of form for which you want to use form styler'),
'#default_value' => $config
->get('form_ids'),
];
$theme_list = \Drupal::service('theme_handler')
->listInfo();
$options = [];
foreach ($theme_list as $theme_name => $theme) {
$options[$theme_name] = $theme->info['name'];
}
$selected_themes = $config
->get('themes_enabled');
$form['themes'] = array(
'#type' => 'checkboxes',
'#title' => $this
->t('Select themes'),
'#description' => $this
->t('Enable for all forms on selected themes'),
'#options' => $options,
'#default_value' => $selected_themes ? $selected_themes : [],
);
return parent::buildForm($form, $form_state);
}