You are here

function scald_galleria_scald_player_settings_form_validate in Scald: Gallery 7.2

Scald player settings form validate handler.

1 string reference to 'scald_galleria_scald_player_settings_form_validate'
scald_galleria_form_alter in scald_galleria/scald_galleria.module
Implements hook_form_alter().

File

scald_galleria/scald_galleria.module, line 142
Scald Galleria is a player for Scald Gallery.

Code

function scald_galleria_scald_player_settings_form_validate($form, &$form_state) {
  if (!preg_match('/^[a-zA-Z0-9%]+$/', $form_state['values']['width'])) {
    form_set_error('width', t('Incorrect width format.'));
  }
  if (!preg_match('/^[a-zA-Z0-9%]+$/', $form_state['values']['height'])) {
    form_set_error('height', t('Incorrect height format.'));
  }
  if (!empty($form_state['values']['options']) && !json_decode($form_state['values']['options'])) {
    form_set_error('options', t('Incorrect options format.'));
  }
}