You are here

public function SettingsForm::buildForm in Multiselect 8

Same name and namespace in other branches
  1. 2.x src/Form/SettingsForm.php \Drupal\multiselect\Form\SettingsForm::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/SettingsForm.php, line 23

Class

SettingsForm
Form builder for the admin display defaults page.

Namespace

Drupal\multiselect\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $config = $this
    ->config('multiselect.settings');
  $form['basic'] = [];
  $form['basic']['multiselect_widths'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Width of Select Boxes (in pixels)'),
    '#default_value' => $config
      ->get('multiselect.widths'),
    '#size' => 3,
    '#field_suffix' => 'px',
    '#required' => TRUE,
  ];
  return $form;
}