You are here

function _swftools_admin_file_handling_options in SWF Tools 6.3

1 call to _swftools_admin_file_handling_options()
swftools_handling_profile_form in includes/swftools.admin.inc
Returns a form definition for the profile file handling page.

File

includes/swftools.admin.inc, line 510
Configuration settings for SWF Tools.

Code

function _swftools_admin_file_handling_options($action, $description, $profile = '') {

  // Initialise list of methods
  $list = array();

  // Obtain list of available methods
  $methods = swftools_get_methods($action);
  if (count($methods)) {
    foreach ($methods as $method => $info) {
      if ($info['library'] && !file_exists($info['library'])) {
        $list[$method] = $info['title'] . ' - <span class="error">Missing ' . $info['library'] . '</span>';
        if (isset($info['donwload']) && $info['download']) {
          $list[$method] = $list[$method] . ' - ' . l(t('Download here'), $info['download']);
        }
      }
      else {
        $list[$method] = $info['title'];
      }
    }
  }

  // If there are no handlers reporting then return now
  if (!$list) {
    return;
  }

  // Sort the list of methods
  asort($list);

  // None is always an option so add this at the top of the list, unless 'swf'
  if ($action != 'swf') {
    $list = array(
      t('None'),
    ) + $list;
  }

  // Determine the appropriate default based on $action
  $default = swftools_get_player($action, $profile);

  // swftools_get_player() returns FALSE for nothing configured, change to 0
  if (!$default) {
    $default = 0;
  }
  return array(
    '#type' => 'radios',
    '#title' => t('Default player for ' . $description),
    '#default_value' => $default,
    '#options' => $list,
  );
}