http://blog.deconcept.com/swfobject/.'); break; } } /** * Implementation of hook_menu(). */ function swfobject_api_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array( 'path' => 'admin/settings/swfobject_api', 'title' => t('SWFObject API'), '#description' => t('Configure the SWFObject API.'), 'access' => user_access('administer nodes'), 'callback' => 'drupal_get_form', 'callback arguments' => 'swfobject_api_settings_form' ); } return $items; } /** * Menu callback: SWFObject API configuration form. */ function swfobject_api_settings_form() { $settings = _swfobject_api_settings(); $form = array(); $form['swfobject_api_settings'] = array( '#type' => 'fieldset', '#title' => t('Settings'), '#tree' => TRUE ); $form['swfobject_api_settings']['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'), '#required' => TRUE ); $form['swfobject_api_settings']['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', ''), ); $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings')); return system_settings_form($form); } /** * Implementation of theme * @param $url * a web accessible url to the flash file * @param $params * An associative array of parameters that describe the SWF * @param $vars * An associative array of variables to pass through to the SWF flashvars value * @return * themed html */ function theme_swfobject_api($url, $params = null, $vars = null) { $path = drupal_get_path('module', 'swfobject_api'); drupal_add_js($path .'/swfobject.js'); $base_params = array( 'width' => '100%', 'height' => '100%', 'no_flash' => t('Sorry, you need to install flash to see this content.'), 'version' => variable_get('swfoa_version', '5'), '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']; } $name = form_clean_id(str_replace('.swf', '', basename($url))); $html = '