function _autologout_user_uid_timeout_validate in Automated Logout 8
Same name and namespace in other branches
- 6.4 autologout.module \_autologout_user_uid_timeout_validate()
- 7.4 autologout.module \_autologout_user_uid_timeout_validate()
Form validation.
1 string reference to '_autologout_user_uid_timeout_validate'
- autologout_form_user_form_alter in ./
autologout.module - Implements hook_form_FORM_ID_alter().
File
- ./
autologout.module, line 68 - Automated Logout - Module.
Code
function _autologout_user_uid_timeout_validate($element, FormStateInterface $form_state) {
$max_timeout = \Drupal::config('autologout.settings')
->get('max_timeout');
$timeout = $element['#value'];
// Set error if timeout isn't strictly a number between 60 and max.
if ($timeout != "" && ($timeout < 10 || $timeout > 0 && $timeout < 60 || $timeout > $max_timeout || !is_numeric($timeout))) {
$form_state
->setError($element, t('The timeout must be an integer greater than 60, and less then %max.', [
'%max' => $max_timeout,
]));
}
}