You are here

function mediafront_preset_save in MediaFront 7.2

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

Saves a new preset.

3 calls to mediafront_preset_save()
mediafront_create_preset_submit in includes/mediafront.preset.inc
Submit handler for the preset form.
mediafront_preset_import_submit in includes/mediafront.preset.inc
Submit handler for the preset import form.
mediafront_preset_submit in includes/mediafront.preset.inc
Submit handler for the preset form.

File

includes/mediafront.preset.inc, line 540

Code

function mediafront_preset_save($preset) {

  // If they provide the pid, then this needs to be an update.
  $pid = isset($preset['pid']) && $preset['pid'] ? array(
    'pid',
  ) : array();

  // Save or update a preset.
  drupal_write_record('mediafront_preset', $preset, $pid);

  // Save this preset in cache.
  cache_set('mediafront_preset_' . $preset['name'], $preset);

  // Display a message.
  drupal_set_message('Preset (' . $preset['name'] . ') settings have been saved.');

  // Tell the player about this preset save.
  $player_save = $preset['player'] . '_mediafront_preset_save';
  if (function_exists($player_save)) {
    $preset['settings'] = isset($preset['settings']) ? $preset['settings'] : array();
    $preset['settings'] = mediafront_get_settings($preset['player'], $preset['settings']);
    $player_save($preset);
  }
}