You are here

function videojs_settings_form_submit in Video.js (HTML5 Video Player) 6.2

Same name and namespace in other branches
  1. 6 includes/videojs.admin.inc \videojs_settings_form_submit()
  2. 7.3 includes/videojs.admin.inc \videojs_settings_form_submit()
  3. 7 includes/videojs.admin.inc \videojs_settings_form_submit()
  4. 7.2 includes/videojs.admin.inc \videojs_settings_form_submit()

Submit handler for the videojs_settings_form() form.

This submit handler is executed before system_settings_form_submit().

1 string reference to 'videojs_settings_form_submit'
videojs_settings_form in includes/videojs.admin.inc
Menu callback; Provides the Video.js settings form.

File

includes/videojs.admin.inc, line 97
Administrative pages for the Video.js module.

Code

function videojs_settings_form_submit($form, &$form_state) {
  $v =& $form_state['values'];

  // Clean all variables before system_settings_form_submit() creates new ones.
  // This prevents variables for removed content types remaining in the variables table.
  db_query("DELETE FROM {variable} WHERE name LIKE 'videojs_%%'");

  // Store width & height as ints, autoplay as bool
  $v['videojs_height'] = intval($v['videojs_height']);
  $v['videojs_width'] = intval($v['videojs_width']);
  $v['videojs_autoplay'] = !empty($v['videojs_autoplay']);

  // Unset variables with empty values
  if ($v['videojs_directory'] == NULL) {
    unset($v['videojs_directory']);
  }
  if ($v['videojs_height'] == 0) {
    unset($v['videojs_height']);
  }
  if ($v['videojs_width'] == 0) {
    unset($v['videojs_width']);
  }
  drupal_set_message(t('The Video.js library (version @version) successfully found in the %directory directory.', array(
    '@version' => $form_state['videojs_version'],
    '%directory' => $form_state['values']['videojs_directory'],
  )));
}