You are here

public function SitemapWarmer::validateConfigurationForm in Warmer 8

Same name and namespace in other branches
  1. 2.x modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php \Drupal\warmer_cdn\Plugin\warmer\SitemapWarmer::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 WarmerPluginBase::validateConfigurationForm

File

modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php, line 113

Class

SitemapWarmer
The cache warmer for the built-in entity cache.

Namespace

Drupal\warmer_cdn\Plugin\warmer

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $min_priority = $form_state
    ->getValue('minPriority');
  if (!is_numeric($min_priority) || !is_float(floatval($min_priority)) || $min_priority < 0 || $min_priority > 1) {
    $form_state
      ->setError($form['minPriority'], $this
      ->t('minPriority should be a float between 0 and 1.'));
  }
  $this
    ->validateHeaders($form, $form_state);
}