I created my own module, which loads an swf Object similar to the included example.
The following line will throw an error instead of returning some html code:
swfembed.module
return theme('swfembed_embed', $swf) . 'Test' . theme('swfembed_embed', $swf2);
Throws error:
( ! ) Fatal error: Cannot use object of type SWFObject as array in /srv/dev-sites/ernewelt/workspace/cyclodex/www/includes/theme.inc on line 813
Looks like there is an problem with the SWFObject which theme tries to handle as array.
Is it needed to convert the SWF Object before the theme call ?
I have a workaround which just puts the called function code into my own function, without calling theme()... Then it works...
/*
* Disabling this call and copy the code of the "theme_swfembed_embed" function
* code into my own here:
*/
function my_function() {
$swf = new SWFObject(.......
...
// Theme the object and return that to the client.
//return theme('swfembed_embed', $swf);
$swf_object = $swf;
swfembed_add_js();
$id = $swf_object->getId();
$settings['swfembed']['swf'][$id] = $swf_object->toArray();
drupal_add_js($settings, array('type'=>'setting'));
return '<div id="' . $id . '">' . $swf_object->getNoFlash() . '</div>';
}
Any hints, ideas, fixes for the real code, regarding the theme call ?
Comments
Comment #1
valderama CreditAttribution: valderama commentedhey,
The problem is that in Drupal 7 the theme function changed, it now has another signature and awaits an array. See http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/7
change your code to
and it should work.
The documentation is not yet up to date, it seems.
Comment #2
Cyclodex CreditAttribution: Cyclodex commentedIt works , great ! Thanks for feedback!
Comment #4
joeysantiago CreditAttribution: joeysantiago commentedI can't make it work neither with the provided code. My version is 7.x-1.4.
thanks
Comment #5
pelicani CreditAttribution: pelicani commentedjoey, if you are still having a problem, a year later, please report an error message.
there are many possible explanations.
the swfembed module isn't enabled
the swf location is incorrect
the code in the wrong place
the $content variable is not output
or there may be an unrelated error.
anyway, if you still need help, I hope this helps.
peace,
michael
Comment #5.0
pelicani CreditAttribution: pelicani commentedrenamed the function to a more general name