function theme_file_formatter_table

Returns HTML for a file attachments table.

Parameters

$variables: An associative array containing:

  • items: An array of file attachments.

Related topics

1 theme call to theme_file_formatter_table()
file_field_formatter_view in modules/file/file.field.inc
Implements hook_field_formatter_view().

File

modules/file/file.field.inc, line 1017

Code

function theme_file_formatter_table($variables) {
    $header = array(
        t('Attachment'),
        t('Size'),
    );
    $rows = array();
    foreach ($variables['items'] as $delta => $item) {
        $rows[] = array(
            theme('file_link', array(
                'file' => (object) $item,
            )),
            format_size($item['filesize']),
        );
    }
    return empty($rows) ? '' : theme('table', array(
        'header' => $header,
        'rows' => $rows,
    ));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.