public function SettingsForm::validateForm in Access unpublished 8
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ SettingsForm.php, line 104
Class
- SettingsForm
- Configure access unpublished settings for this site.
Namespace
Drupal\access_unpublished\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$strtotime = @strtotime($form_state
->getValue('cleanup_expired_tokens_period'));
if (!$strtotime) {
$form_state
->setErrorByName('cleanup_expired_tokens_period', $this
->t('The relative start date value entered is invalid.'));
}
elseif ($strtotime > time()) {
$form_state
->setErrorByName('cleanup_expired_tokens_period', $this
->t('The value has to be negative.'));
}
}