You are here

function mediafront_preset_submit in MediaFront 6.2

Same name and namespace in other branches
  1. 6 includes/mediafront.preset.inc \mediafront_preset_submit()
  2. 7.2 includes/mediafront.preset.inc \mediafront_preset_submit()
  3. 7 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 304

Code

function mediafront_preset_submit($form, &$form_state) {
  $preset = array();
  if (isset($form_state['values']['pid'])) {
    $preset['pid'] = $form_state['values']['pid'];
  }
  $preset['name'] = $form_state['values']['name'];
  $preset['description'] = $form_state['values']['description'];
  $preset['player'] = $form_state['values']['player'];
  $preset['connect'] = array(
    'iscontroller' => isset($form_state['values']['iscontroller']) ? $form_state['values']['iscontroller'] : array(),
    'isplaylist' => isset($form_state['values']['isplaylist']) ? $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'];
}