You are here

public function SettingsForm::buildForm in Menu Link Weight 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\menu_link_weight\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 30

Class

SettingsForm
Configure menu link weight settings.

Namespace

Drupal\menu_link_weight\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('menu_link_weight.settings');
  $form['menu_parent_form_selector'] = array(
    '#type' => 'select',
    '#title' => t('Parent menu link selector'),
    '#default_value' => $config
      ->get('menu_parent_form_selector') ? $config
      ->get('menu_parent_form_selector') : 'default',
    '#options' => [
      'cshs' => $this
        ->t('Client-side hierarchical select'),
    ],
    '#required' => TRUE,
    '#empty_option' => $this
      ->t('Default'),
    '#empty_value' => 'default',
  );
  return parent::buildForm($form, $form_state);
}