function template_preprocess_osmplayer in MediaFront 6.2
Same name and namespace in other branches
- 6 players/osmplayer/osmplayer.module \template_preprocess_osmplayer()
- 7 players/osmplayer/osmplayer.module \template_preprocess_osmplayer()
The template preprocess function for the osm media player.
Parameters
$variables - The :
Return value
unknown_type
1 string reference to 'template_preprocess_osmplayer'
- osmplayer_theme in players/
osmplayer/ osmplayer.module - Implementation of hook_theme()
File
- players/
osmplayer/ osmplayer.module, line 807
Code
function template_preprocess_osmplayer(&$variables) {
global $base_url, $user;
// Let the mediafront populate all the variables for us.
mediafront_template_preprocess($variables);
// Get the media player.
$player = osmplayer_get_player_object($variables['params']);
if ($player) {
$variables['params']['id'] = $player
->getId();
// Add the javascript for this player.
osmplayer_add_js($player);
// Add the CSS files for this player.
osmplayer_add_css($player, $variables['params']['preset']);
// Make sure they always have a template, theme, and version...
$template = $variables['params']['template'] = $player
->getTemplate();
$variables['params']['theme'] = $player
->getTheme();
$variables['params']['version'] = $player->template
->getVersion();
// Get the player prefix.
$variables['params']['prefix'] = $player
->getPrefix();
// Now set up our templates within a template.
$variables['templates']['teaservoter'] = theme('osmplayer_' . $variables['params']['template'] . '_teaservoter', $variables['params'], $variables['templates']);
$variables['templates']['voter'] = theme('osmplayer_' . $variables['params']['template'] . '_nodevoter', $variables['params'], $variables['templates']);
$variables['templates']['controlBar'] = theme('osmplayer_' . $variables['params']['template'] . '_controlbar', $variables['params'], $variables['templates']);
$variables['templates']['titlebar'] = theme('osmplayer_' . $template . '_titlebar', $variables['params'], $variables['templates']);
$variables['templates']['menu'] = theme('osmplayer_' . $template . '_menu', $variables['params'], $variables['templates']);
$variables['templates']['node'] = theme('osmplayer_' . $template . '_node', $variables['params'], $variables['templates']);
$variables['templates']['teaser'] = theme('osmplayer_' . $variables['params']['template'] . '_teaser', $variables['params'], $variables['templates']);
$variables['templates']['scrollBar'] = theme('osmplayer_' . $variables['params']['template'] . '_scrollbar', $variables['params'], $variables['templates']);
$variables['templates']['links'] = $variables['params']['links'] ? theme('osmplayer_' . $variables['params']['template'] . '_links', $variables['params'], $variables['templates']) : '';
$variables['templates']['pager'] = theme('osmplayer_' . $variables['params']['template'] . '_pager', $variables['params'], $variables['templates']);
$variables['templates']['playlist'] = theme('osmplayer_' . $template . '_playlist', $variables['params'], $variables['templates']);
// Determine the width and height.
$width = $variables['params']['playlistOnly'] && $variables['params']['vertical'] ? '' : 'width:' . $variables['params']['width'] . 'px;';
$variables['width'] = $variables['params']['fluidWidth'] ? 'width:100%;' : $width;
$height = $variables['params']['playlistOnly'] && !$variables['params']['vertical'] || $variables['params']['controllerOnly'] ? '' : 'height:' . $variables['params']['height'] . 'px;';
$variables['height'] = $variables['params']['fluidHeight'] ? 'height:100%;' : $height;
}
}