You are here

public function ToolbarSettingsForm::buildForm in Devel 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/ToolbarSettingsForm.php \Drupal\devel\Form\ToolbarSettingsForm::buildForm()
  2. 8 src/Form/ToolbarSettingsForm.php \Drupal\devel\Form\ToolbarSettingsForm::buildForm()
  3. 4.x src/Form/ToolbarSettingsForm.php \Drupal\devel\Form\ToolbarSettingsForm::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/ToolbarSettingsForm.php, line 66

Class

ToolbarSettingsForm
Configures devel toolbar settings.

Namespace

Drupal\devel\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('devel.toolbar.settings');
  $form['toolbar_items'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Menu items always visible'),
    '#options' => $this
      ->getLinkLabels(),
    '#default_value' => $config
      ->get('toolbar_items') ?: [],
    '#required' => TRUE,
    '#description' => $this
      ->t('Select the menu items always visible in devel toolbar tray. All the items not selected in this list will be visible only when the toolbar orientation is vertical.'),
  ];
  return parent::buildForm($form, $form_state);
}