You are here

function mediafront_get_preset_params in MediaFront 7.2

Provided the preset and an additional array of params, this returns the player params.

Parameters

type $preset:

type $params:

Return value

string

2 calls to mediafront_get_preset_params()
mediafront_get_player in ./mediafront.module
Returns a media player.
osmplayer_media_colorbox_preprocess in players/osmplayer/osmplayer.module
Preprocess a colorbox to add a mediafront preset to it.

File

./mediafront.module, line 818

Code

function mediafront_get_preset_params($preset, $params = array()) {
  $players =& drupal_static(__FUNCTION__);
  $preset = mediafront_get_preset($preset, is_array($params) && !empty($params['admin']));
  $params = !empty($params) ? !empty($preset['settings']) ? array_merge($preset['settings'], $params) : $params : $preset['settings'];
  $params['preset'] = $preset['name'];
  $params['player'] = $preset['player'];
  $params['protocol'] = 'json';
  $params['connect'] = !empty($params['connect']) ? $params['connect'] : (!empty($preset['connect']) ? $preset['connect'] : array());
  if (empty($params['id'])) {
    $params['id'] = 'mediafront_' . $preset['name'];

    // Find a unique id for this player.
    $i = 1;
    $id = $params['id'];
    while (isset($players[$id])) {
      $id = $params['id'] . '_' . $i++;
    }

    // Set the id.
    $params['id'] = $id;
  }

  // Add to the players array.
  $players[$params['id']] = $params['id'];
  return $params;
}