public function LeafletMap::validateOptionsForm in Leaflet 2.1.x
Same name and namespace in other branches
- 8 modules/leaflet_views/src/Plugin/views/style/LeafletMap.php \Drupal\leaflet_views\Plugin\views\style\LeafletMap::validateOptionsForm()
- 2.0.x modules/leaflet_views/src/Plugin/views/style/LeafletMap.php \Drupal\leaflet_views\Plugin\views\style\LeafletMap::validateOptionsForm()
Validate the options form.
Overrides StylePluginBase::validateOptionsForm
File
- modules/
leaflet_views/ src/ Plugin/ views/ style/ LeafletMap.php, line 620
Class
- LeafletMap
- 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);
$style_options = $form_state
->getValue('style_options');
if (!empty($style_options['height']) && (!is_numeric($style_options['height']) || $style_options['height'] <= 0)) {
$form_state
->setError($form['height'], $this
->t('Map height needs to be a positive number.'));
}
}