public function WorkbenchSettingsForm::buildForm in Workbench 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/ WorkbenchSettingsForm.php, line 34 - Settings form for Workbench module.
Class
- WorkbenchSettingsForm
- Generates the Workbench configuration form.
Namespace
Drupal\workbench\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('workbench.settings');
$form['help'] = [
'#markup' => $this
->t('Workbench provides three pages that can be configured. The overview "My Workbench" page has three content sections, while the "My edits" and "All recent content" pages have one. Select the View and display that you wish to use.'),
];
foreach ($this
->settingsItems() as $key => $label) {
$form[$key] = [
'#title' => $label,
'#type' => 'select',
'#options' => $this
->getOptions(),
'#default_value' => $config
->get($key),
];
}
return parent::buildForm($form, $form_state);
}