Hi,
I’m trying to add a Flash object to
an existing module.
I’ve tried a couple of ways without
success.
I’ve created a module.
I have SWFTool with SWFObject2 enabled
Using JS as per this
$(document).ready(function(){
var
flashtags = $('<div>[swf
file="http://XXX/sites/all/modules/flashtags/flash/flashtags.swf"]</div>').appendTo('#privatemsg-new').get(0);
if
(Drupal.jsEnabled) {
Drupal.attachBehaviors(flashtags);
}
});
By doing that I end up with this printed
at the bottom of the form
[swf file="http://XXX/sites/all/modules/flashtags/flash/flashtags.swf"]
But no Flash object.
I tried this approach…
function privatemsg_form_alter(&$form, $form_state, $form_id) {
$vars['swf_tags'] = swf("http://XXX/sites/all/modules/flashtags/flash/flashtags.swf",
array('width' => '420', 'height' => '140', 'bgcolor' => '#336699'), FALSE,
array('html_alt' => 'Name of site if flash is disabled.')
);
if ($form_id == 'privatemsg_new' && user_access('create flashtags')) {
$form['privatemsg']['flashtags'] = array(
'#type' => 'fieldset',
'#access' => user_access('create flashtags'),
'#title' => t('Flash Tags'),
'#collapsible' => FALSE,
'#collapsed' => empty($form['#privatemsg_message']['flashtags']),
'#description' => t('Flashtags are used to add a context to a message and
only viewable by the sender.'),
'#prefix' => '<div
class="flashtags">',
'#value'
=> print $swf_tags,
'#suffix' => '</div>',
'#weight' => 1,
);
}
}
Obviously
I’m missing something in understanding how to make that work. It’s
creating a field set on the form but no Flash object. Value is unlikely to be
the right name. I’m not sure what this should be.
Anyone
got some clues for me on this?
Yani