You are here

public function AdminToolbarSettingsForm::buildForm in Admin Toolbar 3.x

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/AdminToolbarSettingsForm.php, line 79

Class

AdminToolbarSettingsForm
Class AdminToolbarSettingsForm. The config form for the admin_toolbar module.

Namespace

Drupal\admin_toolbar\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('admin_toolbar.settings');
  $depth_values = range(1, 9);
  $form['menu_depth'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Menu depth'),
    '#description' => $this
      ->t('Maximal depth of displayed menu.'),
    '#default_value' => $config
      ->get('menu_depth'),
    '#options' => array_combine($depth_values, $depth_values),
  ];
  return parent::buildForm($form, $form_state);
}