You are here

function theme_mediafront_player in MediaFront 7.2

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

Implement the theme for the media player.

File

./mediafront.module, line 83

Code

function theme_mediafront_player($variables) {

  // Get the correct variables.
  $variables = !empty($variables['element']) ? array_shift($variables) : $variables;

  // Get the entity and preset.
  $entity = $variables['#entity'];

  // If no fields are provided then return nothing...
  if (empty($variables['#fields'])) {
    return '';
  }

  // Add the node to the media player.
  $params = array(
    'node' => mediafront_get_node('node', $entity, $variables['#fields']),
  );

  // Nodes will never need the playlist.
  $params['disablePlaylist'] = true;

  // Add the variables to the params in case we need it in other hooks.
  $params['variables'] = $variables;

  // Return the player.
  return mediafront_get_player($variables['#preset'], $params);
}