Commit 65a0a3ef authored by attila.fekete's avatar attila.fekete
Browse files

Readable width validation

parent 6f12e7e6
...@@ -217,7 +217,9 @@ function soundcloudfield_field_instance_settings_form($field, $instance) { ...@@ -217,7 +217,9 @@ function soundcloudfield_field_instance_settings_form($field, $instance) {
* Validate the field settings form. * Validate the field settings form.
*/ */
function soundcloudfield_settings_form_validate($element, &$form_state, $complete_form) { function soundcloudfield_settings_form_validate($element, &$form_state, $complete_form) {
if (!empty($form_state['values']['instance']['settings']['soundcloudplayer']['width']) && ($form_state['values']['instance']['settings']['soundcloudplayer']['width'] < 1 || $form_state['values']['instance']['settings']['soundcloudplayer']['width'] > 100)) { // Validate width.
$width = $form_state['values']['instance']['settings']['soundcloudplayer']['width'];
if (!empty($width) && ($width < 1 || $width > 100)) {
form_set_error('instance][settings][soundcloudplayer][width', t('Player width must be a positive integer between 1-100')); form_set_error('instance][settings][soundcloudplayer][width', t('Player width must be a positive integer between 1-100'));
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment