public function CoffeeConfigurationForm::buildForm in Coffee 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/ CoffeeConfigurationForm.php, line 33
Class
- CoffeeConfigurationForm
- Configure Coffee for this site.
Namespace
Drupal\coffee\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('coffee.configuration');
$form['coffee_menus'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Menus to include'),
'#description' => $this
->t('Select the menus that should be used by Coffee to search.'),
'#options' => $this
->getMenuLabels(),
'#default_value' => $config
->get('coffee_menus'),
];
$form['max_results'] = [
'#type' => 'number',
'#title' => $this
->t('Max results'),
'#description' => $this
->t('Maximum number of items to show in the search results.'),
'#default_value' => $config
->get('max_results'),
'#required' => TRUE,
'#min' => 1,
'#max' => 50,
];
return parent::buildForm($form, $form_state);
}