You are here

public function WeatherHourlyBlock::blockValidate in Wunderground weather 8

Overrides BlockPluginTrait::blockValidate

File

src/Plugin/Block/WeatherHourlyBlock.php, line 152
Contains \Drupal\wunderground_weather\Plugin\Block\WeatherHourlyBlock.

Class

WeatherHourlyBlock
Provides a with an hourly weather forecast.

Namespace

Drupal\wunderground_weather\Plugin\Block

Code

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