public function DisclaimerEmailBlock::blockValidate in Disclaimer 8
Overrides BlockPluginTrait::blockValidate
File
- src/
Plugin/ Block/ DisclaimerEmailBlock.php, line 183
Class
- DisclaimerEmailBlock
- Provides a 'DisclaimerEmailBlock' block.
Namespace
Drupal\disclaimer\Plugin\BlockCode
public function blockValidate($form, FormStateInterface $form_state) {
$url_object = $this->pathValidator
->getUrlIfValid($form_state
->getValue('redirect'));
if (!$url_object) {
$form_state
->setErrorByName('redirect', $this
->t('Redirect URL must be valid path.'));
}
if (!preg_match('/^[0-9]+$/', $form_state
->getValue('max_age'))) {
$form_state
->setErrorByName('max_age', $this
->t('Max-age must be integer.'));
}
}