Skip to content

Commit

Permalink
Prevent form submission with insufficient data in views form (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoxela authored Mar 26, 2022
1 parent e1d949f commit 1440814
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/leaflet_views/leaflet_views_plugin_style.inc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ class leaflet_views_plugin_style extends views_plugin_style {
* Validate the options form.
*/
public function options_validate(&$form, &$form_state) {
if (empty($form_state['values']['style_options'])) {
form_set_error('form', t('Insufficient data.'));
return;
}
if (!is_numeric($form_state['values']['style_options']['height']) || $form_state['values']['style_options']['height'] < 0) {
form_error($form['height'], t('Map height needs to be a positive number'));
}
Expand Down

0 comments on commit 1440814

Please sign in to comment.