You are here

public function MenuPositionSettings::buildForm in Menu Position 8

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/MenuPositionSettings.php, line 65

Class

MenuPositionSettings
Class MenuPositionSettings.

Namespace

Drupal\menu_position\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('menu_position.settings');
  $form = [];
  $form['menu_position_active_link_display'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('When a menu position rule matches:'),
    '#options' => [
      'parent' => $this
        ->t('Mark the rule\'s parent menu item as being "active".'),
      'child' => $this
        ->t("Insert the current page's title into the menu tree."),
      'none' => $this
        ->t('Don\'t mark any menu item as being "active".'),
    ],
    '#default_value' => $config
      ->get('link_display'),
    '#description' => $this
      ->t("By default, a matching menu position rule will mark the rule's parent menu item as active."),
  ];
  return parent::buildForm($form, $form_state);
}