You are here

function lutman_swftools_embed in SWF Tools 6

Same name and namespace in other branches
  1. 5 lutman/lutman.module \lutman_swftools_embed()
  2. 6.2 lutman/lutman.module \lutman_swftools_embed()

Implementation of swftools_embed hook Returns the markup for the page, plus set necessary javascript.

File

lutman/lutman.module, line 30

Code

function lutman_swftools_embed($action = 'add_js', $methods = FALSE, $vars = FALSE, $html_alt = '') {
  static $lutman_has_run;

  // Output javascript to the header
  if (!$lutman_has_run) {

    // Add jquery.flash.js
    drupal_add_js(swftools_get_player_path() . '/lutman/jquery.flash.js');
    drupal_add_js(_lutman_header_js(), 'inline', 'header');
    $lutman_has_run = TRUE;
    if ($action == 'add_js') {

      // Exit early having put the javascript in the header.
      return;
    }
  }

  // Use time() to prevent caching issues.
  $html = '<div id="swfobject-id-' . time() . $unique_id . '" class="swftools lutman" ' . swftools_json_params($vars->params, 'swftools') . ' ' . ">\n" . $html_alt . '</div>';
  return $html;
}