You are here

function mediafront_get_player in MediaFront 7.2

Same name and namespace in other branches
  1. 6.2 mediafront.module \mediafront_get_player()
  2. 6 mediafront.module \mediafront_get_player()
  3. 7 mediafront.module \mediafront_get_player()

Returns a media player.

Parameters

- This can either be an associative array with the settings,: or can be the preset string followed by another argument that is the associative array with the settings you wish to override for that preset.

Example: To show the player with settings...

$params['playlist'] = 'videos'; print mediafront_get_player( $params );

Example: To show the player with the 'mypreset' preset.

print mediafront_get_player( 'mypreset' );

Example: To show the player with the 'mypreset' with the settings overrides.

$params['playlist'] = 'videos'; print mediafront_get_player( 'mypreset', $params );

5 calls to mediafront_get_player()
mediafront_handler_area_player::render in views/mediafront_handler_area_player.inc
Render the area.
mediafront_plugin_style_player::render in views/mediafront_plugin_style_player.inc
Renders the media player.
mediafront_preset_form in includes/mediafront.preset.inc
mediafront_tokens in ./mediafront.module
Implements hook_tokens
theme_mediafront_player in ./mediafront.module
Implement the theme for the media player.

File

./mediafront.module, line 868

Code

function mediafront_get_player() {
  $args = func_get_args();
  $params = $args[0];

  // If they pass in a string, then this is a preset.
  if (gettype($params) == 'string') {
    $preset = $params;
    $params = !empty($args[1]) ? $args[1] : array();
    $params = mediafront_get_preset_params($preset, $params);
  }
  if ($params && is_array($params)) {
    drupal_alter('mediafront_settings', $params);
    $params = mediafront_get_settings($params['player'], $params);
    $player = $params && $params['player'] ? $params['player'] : 'osmplayer';
    $getPlayer = $player . '_get_player';
    return function_exists($getPlayer) ? $getPlayer($params) : t('Player not available');
  }
  else {
    return t('Player not available');
  }
}