You are here

public function LogouttabSettingsForm::buildForm in Logout Tab 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/LogouttabSettingsForm.php, line 31

Class

LogouttabSettingsForm
Configure logouttab settings for this site.

Namespace

Drupal\logouttab\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('logouttab.settings');
  $form['url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('URL for the account logout page'),
    '#description' => $this
      ->t('Enter the relative path for the user account logout page.'),
    '#default_value' => $config
      ->get('url'),
    '#field_prefix' => Url::fromRoute('<front>', [], [
      'absolute' => TRUE,
    ])
      ->toString(),
  ];
  $form['weight'] = [
    '#type' => 'weight',
    '#title' => $this
      ->t('Weight of the logout tab'),
    '#default_value' => $config
      ->get('weight'),
    '#delta' => 30,
  ];
  return parent::buildForm($form, $form_state);
}