function swftools_get_actions in SWF Tools 6.3
Retrieves the list of actions, and their descriptions, that modules are presenting to SWF Tools.
Parameters
bool $reset: When TRUE will reset the cache.
Return value
array An array of actions.
3 calls to swftools_get_actions()
- swf in ./
swftools.module - Processes a file, or an array of files, and returns the relevant mark-up to render a Flash based player.
- swftools_admin_handling_form in includes/
swftools.admin.inc - swftools_handling_profile_form in includes/
swftools.admin.inc - Returns a form definition for the profile file handling page.
File
- ./
swftools.module, line 1870 - The primary component of SWF Tools that enables comprehensive media handling.
Code
function swftools_get_actions($reset = FALSE) {
// Cache actions
static $actions;
// If user has requested the cache to be reset then reset it
if ($reset || !isset($actions)) {
if (!$reset && ($cached = cache_get('actions', 'cache_swftools'))) {
$actions = $cached->data;
}
else {
// Build a list of standard actions that SWF Tools knows about from its other modules
$default_actions = array(
'swf' => array(
'#description' => 'a single swf movie',
'#type' => 'swf movies',
'#weight' => -8,
),
'video' => array(
'#description' => 'a single video',
'#type' => 'videos',
'#weight' => -7,
),
'video_list' => array(
'#description' => 'a series of videos',
'#weight' => -6,
),
'audio' => array(
'#description' => 'a single audio file',
'#type' => 'audio',
'#weight' => -5,
),
'audio_list' => array(
'#description' => 'a series of audio files',
'#weight' => -4,
),
'image' => array(
'#description' => 'a single image',
'#type' => 'images',
'#weight' => -3,
),
'image_list' => array(
'#description' => 'a series of images',
'#weight' => -2,
),
'media_list' => array(
'#description' => 'a series of mixed media files',
'#weight' => -1,
),
);
// Plan ahead - give other modules the chance to declare an action
$actions = array();
foreach (module_implements('swftools_actions') as $module) {
$function = $module . '_swftools_actions';
$result = $function();
if (isset($result) && is_array($result)) {
$actions = array_merge($actions, $result);
}
}
// Merge additional or new values over the defaults (allows defaults to be renamed)
$actions = array_merge($default_actions, $actions);
// Sort the list
uasort($actions, 'element_sort');
// Set the cache
cache_set('actions', $actions, 'cache_swftools');
}
}
// Return the list of available actions
return $actions;
}