function _swftools_admin_file_handling_option in SWF Tools 6
Same name and namespace in other branches
- 5 swftools.admin.inc \_swftools_admin_file_handling_option()
- 6.2 swftools.admin.inc \_swftools_admin_file_handling_option()
1 call to _swftools_admin_file_handling_option()
File
- ./
swftools.admin.inc, line 350
Code
function _swftools_admin_file_handling_option($type, $player_directory, $description) {
// Initialise list of methods
$list = array();
// Obtain list of available methods
$methods = swftools_methods_available($type);
if (count($methods)) {
foreach ($methods as $method => $info) {
if (!file_exists($player_directory . $info['shared_file'])) {
$list[$method] = $info['title'] . ' - <span class="error">Missing</span>';
if ($info['download']) {
$list[$method] = $list[$method] . ' - ' . l(t('Download here'), $info['download']);
}
}
else {
$list[$method] = $info['title'];
}
}
}
// Sort the list of methods
asort($list);
// None is always an option so add this at the top of the list
$list = array(
'None',
) + $list;
// Determine the appropriate default based on $type
$default = swftools_get_player($type);
// swftools_get_player() returns FALSE for nothing configured, change to 0
if (!$default) {
$default = 0;
}
return array(
'#type' => 'radios',
'#title' => t($description),
'#default_value' => $default,
'#options' => $list,
);
}