You are here

public function AdminToolbarSearchSettingsForm::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

admin_toolbar_search/src/Form/AdminToolbarSearchSettingsForm.php, line 30

Class

AdminToolbarSearchSettingsForm
Configure Admin Toolbar Search settings for this site.

Namespace

Drupal\admin_toolbar_search\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['display_menu_item'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display the search input as a menu item.'),
    '#description' => $this
      ->t("if set, instead of display a text input field, it's displayed a menu item in the toolbar so the user has to click on it to toggle the search input."),
    '#default_value' => $this
      ->config('admin_toolbar_search.settings')
      ->get('display_menu_item'),
  ];
  return parent::buildForm($form, $form_state);
}