--- swfobject_api.module.orig 2008-09-11 19:57:31.000000000 +0000 +++ swfobject_api.module 2008-12-04 10:25:13.000000000 +0000 @@ -45,25 +45,19 @@ function swfobject_api_menu($may_cache) function swfobject_api_settings_form() { $form = array(); - $form['swfobject_api_settings'] = array( - '#type' => 'fieldset', - '#title' => t('Settings'), - '#tree' => TRUE - ); - $form['swfobject_api_settings']['swfoa_version'] = array( + $form['swfoa_version'] = array( '#type' => 'textfield', '#title' => t('Default minimum version required'), '#description' => t('This value can be overridden via the theme call.'), - '#default_value' => variable_get('swfoa_express', '6'), + '#default_value' => variable_get('swfoa_version', '6'), '#required' => TRUE ); - $form['swfobject_api_settings']['swfoa_express'] = array( + $form['swfoa_express'] = array( '#type' => 'checkbox', '#title' => t('Enable express install.'), '#description' => t('Express install allows player upgrades without having to leave the site. Only versions 6.0.65 and above are supported.'), - '#default_value' => variable_get('swfoa_express', ''), + '#default_value' => variable_get('swfoa_express', FALSE), ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings')); return system_settings_form($form); } @@ -101,12 +95,15 @@ function swfobject_api_build_variables($ * @return * themed html */ -function theme_swfobject_api($url, $params = null, $flashvars = null, $id = null) { +function theme_swfobject_api($url, $params = NULL, $flashvars = NULL, $id = NULL) { static $id_count; - // get the path to thje swf object library - drupal_add_js(drupal_get_path('module', 'swfobject_api') .'/swfobject.js'); - + // get the path to the swf object library + $path = drupal_get_path('module', 'swfobject_api'); + drupal_add_js($path .'/swfobject.js'); + + + $base_params = array( 'width' => '100%', 'height' => '100%', @@ -115,24 +112,23 @@ function theme_swfobject_api($url, $para 'type' => 'movie', 'bg_color' => '#FFFFFF' ); - - $params = array_merge($base_params, $params); - - // Express install redirect URL: as per the SWFObject docs, this should - // actually be xiRedirectUrl; variable name changed for simplicity. - if (isset($param['express_redirect'])) { - $redirect = $param['express_redirect']; - } - + + // merge the parameters + if ($params) { + $params = array_merge($base_params, $params); + } + // create a unique id, use what's passed in, what has been saved locally - if ($id) { $id_count = $id; } + if ($id) { + $id_count = $id; + } else { $id_count = $id_count ? $id_count : 1; } // set the name of the swf file $name = form_clean_id(str_replace('.swf', '', basename($url))) .'_'. $id_count; - + // set the div id to the params if ($params['div_id']) { $div_id = $params['div_id']; @@ -148,39 +144,79 @@ function theme_swfobject_api($url, $para $class = ' class="'. $params['class'] .'"'; unset($params['class']); } - - // build the div structure - $html[] = '