You are here

public function AutologoutBlockForm::buildForm in Automated Logout 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 FormInterface::buildForm

File

src/Form/AutologoutBlockForm.php, line 51

Class

AutologoutBlockForm
Provides a settings for autologout module.

Namespace

Drupal\autologout\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['reset'] = [
    '#type' => 'button',
    '#value' => $this
      ->t('Reset Timeout'),
    '#weight' => 1,
    '#limit_validation_errors' => FALSE,
    '#executes_submit_callback' => FALSE,
    '#ajax' => [
      'callback' => 'autologout_ajax_set_last',
    ],
  ];
  $form['timer'] = [
    '#markup' => $this->autoLogoutManager
      ->createTimer(),
  ];
  return parent::buildForm($form, $form_state);
}