Register XSPF player theme functions

David Lesieur - October 16, 2009 - 23:40
Project:Audio
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description

An .inc file in the 'players' directory may provide a theme function for displaying an XSPF player, but that function never gets registered into the theme registry.

This patch solves that issue. After applying this patch, one may invoke the 'xspf_extended' player with code similar to this:

  if ($player = audio_get_players('name', 'xspf_extended')) {
    return theme($player['theme_xspf'], $xspf_playlist_url));
  }

... where $xspf_playlist_url is a variable containing the URL of an XSPF playlist.

AttachmentSize
audio-register-xspf-player.patch711 bytes

#1

David Lesieur - October 27, 2009 - 22:58

This patch improves on the previous one by allowing:

  • Multiple players per .inc file in the players directory.
  • Passing custom options to the player's theme function (those options being defined in hook_audio_player()).

I'm trying to integrate a skinnable player. I'm providing an item for each skin in hook_audio_player(), all of which are actually pointing to the same theme function. The options passed to the theme function identify the skin to use.

I can't have a separate theme function for each skin because my goal is to (eventually) dynamically find the skins by scanning files in the player's directory.

AttachmentSize
audio-register-xspf-player-606902-1.patch 1.84 KB

#2

drewish - November 25, 2009 - 19:24
Status:needs review» fixed

looks good. committed to HEAD.

 
 

Drupal is a registered trademark of Dries Buytaert.