public function WarmerPluginBase::validateConfigurationForm in Warmer 2.x
Same name and namespace in other branches
- 8 src/Plugin/WarmerPluginBase.php \Drupal\warmer\Plugin\WarmerPluginBase::validateConfigurationForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides PluginFormInterface::validateConfigurationForm
2 calls to WarmerPluginBase::validateConfigurationForm()
- CdnWarmer::validateConfigurationForm in modules/
warmer_cdn/ src/ Plugin/ warmer/ CdnWarmer.php - Form validation handler.
- SitemapWarmer::validateConfigurationForm in modules/
warmer_cdn/ src/ Plugin/ warmer/ SitemapWarmer.php - Form validation handler.
2 methods override WarmerPluginBase::validateConfigurationForm()
- CdnWarmer::validateConfigurationForm in modules/
warmer_cdn/ src/ Plugin/ warmer/ CdnWarmer.php - Form validation handler.
- SitemapWarmer::validateConfigurationForm in modules/
warmer_cdn/ src/ Plugin/ warmer/ SitemapWarmer.php - Form validation handler.
File
- src/
Plugin/ WarmerPluginBase.php, line 98
Class
- WarmerPluginBase
- Base class for warmer plugins that implement settings forms.
Namespace
Drupal\warmer\PluginCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
$frequency = $form_state
->getValue('frequency');
$batch_size = $form_state
->getValue('batchSize');
if (!is_numeric($frequency) || $frequency < 0) {
$form_state
->setError($form[$this
->getPluginId()]['frequency'], $this
->t('Frequency should be a positive number.'));
}
if (!is_numeric($batch_size) || $batch_size < 1) {
$form_state
->setError($form[$this
->getPluginId()]['batchSize'], $this
->t('Batch size should be a number greater than 1.'));
}
}