You are here

function mediafront_preset_submit in MediaFront 7

Same name and namespace in other branches
  1. 6.2 includes/mediafront.preset.inc \mediafront_preset_submit()
  2. 6 includes/mediafront.preset.inc \mediafront_preset_submit()
  3. 7.2 includes/mediafront.preset.inc \mediafront_preset_submit()

Submit handler for the preset form.

1 string reference to 'mediafront_preset_submit'
mediafront_preset_form in includes/mediafront.preset.inc

File

includes/mediafront.preset.inc, line 282

Code

function mediafront_preset_submit($form, &$form_state) {
  $preset = array();
  if (isset($form_state['values']['pid'])) {
    $preset['pid'] = check_plain($form_state['values']['pid']);
  }
  $preset['name'] = check_plain($form_state['values']['name']);
  $preset['description'] = check_plain($form_state['values']['description']);
  $preset['player'] = check_plain($form_state['values']['player']);
  $preset['connect'] = array(
    'iscontroller' => isset($form_state['values']['iscontroller']) ? check_plain($form_state['values']['iscontroller']) : array(),
    'isplaylist' => isset($form_state['values']['isplaylist']) ? check_plain($form_state['values']['isplaylist']) : array(),
  );

  // Now set the player settings that are only different from the defaults.
  $preset['settings'] = mediafront_get_settings($preset['player'], mediafront_preset_array_flatten($form_state['values']['player_settings']));

  // Save this preset.
  mediafront_preset_save($preset);
  $form_state['redirect'] = mediafront_get_presets_path() . '/preset/' . $preset['name'];
}