public function Leaflet::validateOptionsForm in Leaflet 8
Same name and namespace in other branches
- 2.1.x modules/leaflet_views/src/Plugin/views/style/Leaflet.php \Drupal\leaflet_views\Plugin\views\style\Leaflet::validateOptionsForm()
- 2.0.x modules/leaflet_views/src/Plugin/views/style/Leaflet.php \Drupal\leaflet_views\Plugin\views\style\Leaflet::validateOptionsForm()
Validate the options form.
Overrides StylePluginBase::validateOptionsForm
File
- modules/
leaflet_views/ src/ Plugin/ views/ style/ Leaflet.php, line 165
Class
- Leaflet
- Style plugin to render a View output as a Leaflet map.
Namespace
Drupal\leaflet_views\Plugin\views\styleCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);
$height = $form_state
->getValue([
'style_options',
'height',
]);
if (!empty($style_options['height']) && (!is_numeric($height) || $height <= 0)) {
$form_state
->setError($form['height'], $this
->t('Map height needs to be a positive number.'));
}
}