function theme_flashnode in Flash Node 6.2
Same name and namespace in other branches
- 5.6 flashnode.module \theme_flashnode()
- 5.3 flashnode.module \theme_flashnode()
- 6.3 flashnode.module \theme_flashnode()
Create the HTML for insertion of Flash This theme function will constrain the size of the content according to the limits set on the configuration page. It then calls a secondary theme function to produce the actual HTML markup.
Parameters
$flashnode: A structured array that defines an item of Flash content. Must include keys filepath (path to the file), width, height, substitution (string containing HTML mark up for the substitution content), and optionally flashvars. Other keys may be included and they will be passed through to SWFTools. Key Comment filepath path to an swf file to theme width display width of the swf file height display height of the movie substitution substitution content to use if using JavaScript insertion flashvars flashvars string to pass to the swf file base base parameter to pass to the swf fil
$teaser: Flag to indicate whether teaser content is being generated. Not used by flash node but could be used by other themers to provide different output depending on mode
$options: Optional array of other parameters that will passed through to swf tools theme function
Return value
An HTML string for rendering the flash content
3 theme calls to theme_flashnode()
- flashnode_content in ./
flashnode.module - Given a flash node nid and option parameters return the HTML string required to generate the required flash content (this is used by the macro system)
- flashnode_help in ./
flashnode.module - Implementation of hook_help
- flashnode_view in ./
flashnode.module - Implementation of hook_view
File
- ./
flashnode.module, line 973
Code
function theme_flashnode($flashnode, $teaser = FALSE, $options = array()) {
// Get height and width limits according to view mode, and if in teaser mode then apply teaser scaling
if ($teaser) {
$max_width = variable_get('flashnode_max_teaser_width', 0);
$max_height = variable_get('flashnode_max_teaser_height', 0);
$teaser_scale = variable_get('flashnode_teaser_scale', 1);
$flashnode['width'] = $flashnode['width'] * $teaser_scale;
$flashnode['height'] = $flashnode['height'] * $teaser_scale;
}
else {
$max_width = variable_get('flashnode_max_width', 0);
$max_height = variable_get('flashnode_max_height', 0);
}
// Check width does not exceed defined maximum, and scale if required
if ($max_width) {
if ($flashnode['width'] > $max_width) {
$scale = $max_width / $flashnode['width'];
$flashnode['width'] = $flashnode['width'] * $scale;
$flashnode['height'] = $flashnode['height'] * $scale;
}
}
// Now check height does not exceed defined maximum, and scale if required
if ($max_height) {
if ($flashnode['height'] > $max_height) {
$scale = $max_height / $flashnode['height'];
$flashnode['width'] = $flashnode['width'] * $scale;
$flashnode['height'] = $flashnode['height'] * $scale;
}
}
// Generate output
$output .= theme('flashnode_markup', $flashnode, $options);
// Return the HTML
return $output;
}