function flash_display in Flash Node 5
Create the HTML for insertion of Flash - relies on ufo.js http://www.bobbyvandersluis.com/ufo/
2 calls to flash_display()
- flash_content in ./
flash.module - Function to retrive and inject flash, based on an array of arguments
- flash_view in ./
flash.module - Implementation of hook_view
File
- ./
flash.module, line 526
Code
function flash_display($file, $options = NULL) {
/**
* Start a static counter to identify each flash div
* The div id is constructed from the time and the count
* This is needed to ensure id's created and cached by the filter do not clash with those generated by simple nodes
* Old code simply generated random numbers so there was a theoretical risk of a clash
* although I never saw it happen. I think this version is more robust, while allowing the filter cache to
* remain in effect?
*/
static $div_count = 1;
$div_id = time() . '-' . $div_count;
// get the path data
$flash_dir = base_path() . drupal_get_path('module', 'flash');
// if we have specified a class for flash content, retrieve it now
$class = $file['class'] ? $file['class'] : 'flash';
// if options were supplied then prepend a comma and implode to make a string
if ($options) {
$options = ', ' . implode(', ', $options);
}
// Construct Flash div with default content
$output .= t('<div id="ufo-!id" class="!class">
<p>You are missing some Flash content!</p>
<p>Maybe your browser does not have javascript enabled, perhaps you don\'t have the version of Flash this content needs (it needs at least version !version), or perhaps the content hasn\'t initialised correctly. Please check your settings and then try again. Thank you!</p>
</div>', array(
'!class' => $class,
'!id' => $div_id,
'!version' => $file['version'],
));
$output .= t('<script type="text/javascript"> var FO = { movie:"!movie", width:"!width", height:"!height", majorversion:"!version", build:"!build", xi:"true", ximovie:"!flash_dir/ufo.swf"!options }; UFO.create(FO, "ufo-!id"); </script>', array(
'!movie' => base_path() . file_create_path($file['_flash']),
'!flash_dir' => $flash_dir,
'!height' => $file['height'],
'!width' => $file['width'],
'!version' => $file['version'],
'!build' => $file['build'],
'!id' => $div_id,
'!options' => $options,
));
// increment the div counter in case there is more flash to show
$div_count += 1;
// return the HTML
return $output;
}