AutologoutBlockForm.php in Automated Logout 8
File
src/Form/AutologoutBlockForm.php
View source
<?php
namespace Drupal\autologout\Form;
use Drupal\autologout\AutologoutManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class AutologoutBlockForm extends FormBase {
protected $autoLogoutManager;
public function getFormId() {
return 'autologout_block_settings';
}
public function __construct(AutologoutManagerInterface $autologout) {
$this->autoLogoutManager = $autologout;
}
public static function create(ContainerInterface $container) {
return new static($container
->get('autologout.manager'));
}
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);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}