You are here

function swftools_methods_available in SWF Tools 6.2

Same name and namespace in other branches
  1. 5 swftools.module \swftools_methods_available()
  2. 6 swftools.module \swftools_methods_available()

Collect information from all modules about the players and embedding methods available.

Parameters

$action: Optional parameter to retrieve data only about a specific method.

$reset: Optional parameter which if TRUE will reset the method cache and rebuild it.

Return value

An array of data describing the available methods.

8 calls to swftools_methods_available()
swf in ./swftools.module
Return output, which might be embed markup, or pre-flash markup that includes the appropriate jQuery added to the <head>
swftools_admin_embed_form in ./swftools.admin.inc
swftools_admin_generic_form in ./genericplayers.module
Implementation of swftools_admin_hook_form. Return the system settings page for generic players
swftools_menu in ./swftools.module
Implementation of hook_menu().
swftools_push_js in ./swftools.module
Add to the page any supporting files required by a given embedding method.

... See full list

File

./swftools.module, line 576

Code

function swftools_methods_available($action = NULL, $reset = FALSE) {

  // Cache methods array as it may be called several times
  static $methods;

  // If user has requested the cache to be reset then reset it
  if (!isset($methods) || $reset) {
    if (!$reset && ($cache = cache_get('swftools:methods')) && !empty($cache->data)) {
      $methods = $cache->data;
    }
    else {
      $methods = module_invoke_all('swftools_methods');
      cache_set('swftools:methods', $methods, 'cache', CACHE_PERMANENT);
    }
  }

  // In case no module is presenting a method for the required action the
  // following line avoids a notice error
  if ($action) {
    $methods += array(
      $action => NULL,
    );
  }

  // Return results - either for the specific action, or the whole array
  return $action ? $methods[$action] : $methods;
}