You are here

function videojs_field_formatter_settings_form_validate in Video.js (HTML5 Video Player) 7.3

Same name and namespace in other branches
  1. 7.2 videojs.module \videojs_field_formatter_settings_form_validate()
1 string reference to 'videojs_field_formatter_settings_form_validate'
videojs_field_formatter_settings_form in ./videojs.module
Implements hook_field_formatter_settings_form().

File

./videojs.module, line 307
Provides an HTML5-compatible with Flash-fallback video player.

Code

function videojs_field_formatter_settings_form_validate($form, &$form_state) {
  $value = drupal_array_get_nested_value($form_state['values'], $form['#parents']);
  $options = videojs_utility::getDisplaySettingsFormResults($value);
  $value = array_merge($value, $options);

  // The fields need to be both entered or both empty
  if (empty($value['width']) != empty($value['height'])) {
    form_error($form[empty($value['width']) ? 'height' : 'width'], t('The width and height field need to be both set or both empty.'));
  }
  if (empty($value['width'])) {
    $value['width'] = NULL;
    $value['height'] = NULL;
  }
  drupal_array_set_nested_value($form_state['values'], $form['#parents'], $value);
}