You are here

function _emfield_swfobject_api_ensure_swfobject in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 6.3 deprecated/emfield-deprecated.themes.inc \_emfield_swfobject_api_ensure_swfobject()
  2. 6 includes/themes/emfield.themes.inc \_emfield_swfobject_api_ensure_swfobject()

Ensure that the necessary JS files are loaded.

This function automatically checks to make sure that the JS files are only loaded once.

Parameters

array $settings:

1 call to _emfield_swfobject_api_ensure_swfobject()
theme_emfield_swfobject in includes/themes/emfield.themes.inc
Theme function to add a flash file to the page.

File

includes/themes/emfield.themes.inc, line 101
Basic theme functions for Embedded Media Field.

Code

function _emfield_swfobject_api_ensure_swfobject($settings = array()) {
  static $done = FALSE;
  if (!$done) {

    // Load the swfobject library and our add-on to activate it.
    drupal_add_js(variable_get('emfield_swfobject_location', ''), 'module', 'header');

    // Load the JS which creates loads the params into the page
    drupal_add_js(drupal_get_path('module', 'emfield') . '/includes/js/swfobject_api.js', 'module', 'footer');
    $done = TRUE;
  }
  drupal_add_js($settings, 'setting', 'footer', FALSE, TRUE, FALSE);
}