function theme_swftools_embed in SWF Tools 6.3
Same name and namespace in other branches
- 5 swftools.module \theme_swftools_embed()
- 6 swftools.module \theme_swftools_embed()
- 6.2 swftools.module \theme_swftools_embed()
Produces finished markup ready for inserting on the page.
This function hands off to the appropriate embedding theme first, and then wraps the result in some wrapper divs before returning the result.
Parameters
array $data: An SWF Tools array of data.
Return value
string An HTML string that generates the output
Related topics
1 theme call to theme_swftools_embed()
- swf in ./
swftools.module - Processes a file, or an array of files, and returns the relevant mark-up to render a Flash based player.
File
- includes/
swftools.theme.inc, line 30 - Implements SWF Tools theme functions.
Code
function theme_swftools_embed($data) {
// Call the specific embedding function - this generates the mark to render the swf
// The default is a theme with the same name as the method, but this can be over-ridden by modifying the theme key
/**
* Note that the theme functions expect to receive the fileurl as a separate parameter to the
* data array. Strictly we could just pass the data array, but if we rewrite the theme
* functions then it will break other modules that are calling using separate file and data
* array. For now (SWF Tools 6) leave this as it is, but for SWF Tools 7 we will simply pass
*/
$embed_markup = theme($data['resolved_methods']['embed']['theme'], $data['othervars']['fileurl'], $data, variable_get('swftools_javascript_location', SWFTOOLS_JAVASCRIPT_INLINE));
// Prepare an array of classes to include in the wrapper div
$classes[] = 'swftools';
$classes[] = 'swftools-' . str_replace('_', '-', $data['resolved_methods']['player']['name']);
// If the user provided class data already then don't over-rule it
if (!empty($data['othervars']['class'])) {
$classes[] = $data['othervars']['class'];
}
// TODO: Accommodate weights on this?
// Allow for handling of #prefix and #suffix supplied via othervars
$data['othervars'] += array(
'#prefix' => '',
'#suffix' => '',
);
// Wrap $embed_markup with prefix and suffix (e.g. to add accessible controls)
$embed_markup = $data['othervars']['#prefix'] . $embed_markup . $data['othervars']['#suffix'];
// Return completed markup
return '<div id="swftools-' . $data['othervars']['id'] . '" class="' . implode(' ', $classes) . '">' . $embed_markup . '</div>';
}