You are here

function file_force_upload_attachments in File Force Download 6.2

Displays file attachments in table

3 string references to 'file_force_upload_attachments'
file_force_itweak_uploads_prerender_alter in ./file_force.module
Implementation of hook_itweak_uploads_prerender_alter().
file_force_settings in ./file_force.admin.inc
Form builder; Configure File Force settings.
file_force_theme_registry_alter in ./file_force.module
Implementation of hook_theme_registry_alter().

File

./file_force.theme.inc, line 16
file_force.theme.inc

Code

function file_force_upload_attachments($files) {
  $header = array(
    t('Attachment'),
    t('Size'),
  );
  $rows = array();
  foreach ($files as $file) {
    $file = (object) $file;
    if ($file->list && empty($file->remove)) {
      $href = file_force_create_url($file->filepath);
      $text = $file->description ? $file->description : $file->filename;
      $rows[] = array(
        l($text, $href, array(
          'query' => array(
            'download' => 1,
          ),
        )),
        format_size($file->filesize),
      );
    }
  }
  if (count($rows)) {
    return theme('table', $header, $rows, array(
      'id' => 'attachments',
    ));
  }
}