I need to set a specific id in the object tag.
I've added an optional $object_id parameter to the class constructor.
If no object_id is specified, will default to $div_id + "_object".
I've added a getObjectId() getter for completion.
Works for me.

Any feedback welcome.

Comments

amontero’s picture

Status: Active » Needs review
StatusFileSize
new2.37 KB
amontero’s picture

Title: Allow specifying an ID property for the OBJECT tag » Allow specifying an ID property for the OBJECT tag (patch attached)
Category: bug » feature

Correcting status and bumping :)

aniebel’s picture

Thanks for this! I patched and I'm getting an error. I presume it's how I configured the markup. What's the proper syntax for the id?

Fatal error: Call to undefined method SWFObject::id() in /home/kfswebdev1/dev.kfspower.com/drupal/modules/php/php.module(80) : eval()'d code on line 6

My markup:

<?php
$swf = new SWFObject(base_path() .'kfs_splash.swf');
$swf->param('allowFullScreen', 'false')   
->param('type','movie')        
->param('wmode','transparent')
->object_id('kfs-splash')
->flashVar('maintainAspectRation', 'true')        
->height(700)    ->width(1000)    
->noFlash('Install flash.')  
->minimumVersion('9.0.28');
return theme('swfembed_embed', array('swf' => $swf));
?>
amontero’s picture

Hi aniebel.

I assign the object id on SWFObject creation like this:

$swf = new SWFObject(base_path() .'kfs_splash.swf', 'your_object_id');

There's no object_id method for setting it afterwards. Just a getObjectId readonly property.
Hope this helps.

aniebel’s picture

Ok, thank you amontero!