You are here

public function WeatherForecastBlock::blockValidate in Wunderground weather 8

Overrides BlockPluginTrait::blockValidate

File

src/Plugin/Block/WeatherForecastBlock.php, line 156
Contains \Drupal\wunderground_weather\Plugin\Block\WeatherForecastBlock.

Class

WeatherForecastBlock
Provides a with a five day weather forecast.

Namespace

Drupal\wunderground_weather\Plugin\Block

Code

public function blockValidate($form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue([
    'number_of_days',
  ]) > 10) {
    $form_state
      ->setErrorByName('number_of_days', $this
      ->t('You cannot display more than 10 days'));
  }
}