function theme_feeds_upload in Feeds 7.2
Same name and namespace in other branches
- 8.2 feeds.pages.inc \theme_feeds_upload()
- 6 feeds.pages.inc \theme_feeds_upload()
- 7 feeds.pages.inc \theme_feeds_upload()
Theme upload widget.
File
- ./
feeds.pages.inc, line 457 - Menu callbacks, form callbacks and helpers.
Code
function theme_feeds_upload($variables) {
$element = $variables['element'];
drupal_add_css(drupal_get_path('module', 'feeds') . '/feeds.css');
_form_set_class($element, array(
'form-file',
));
$summary = '';
if (!empty($element['#file_info'])) {
$file = $element['#file_info'];
$wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
$summary .= '<div class="feeds-file-info">';
$summary .= '<div class="feeds-file-name">';
if ($wrapper) {
$summary .= l($file->filename, $wrapper
->getExternalUrl());
}
else {
$summary .= t('URI scheme %scheme not available.', array(
'%scheme' => file_uri_scheme($uri),
));
}
$summary .= '</div>';
$summary .= '<div class="file-size">';
$summary .= format_size($file->filesize);
$summary .= '</div>';
$summary .= '<div class="feeds-file-mime">';
$summary .= check_plain($file->filemime);
$summary .= '</div>';
$summary .= '</div>';
}
// Prepend the summary to the form field.
$element['#children'] = '<div class="feeds-file">' . $summary . '<div class="feeds-file-upload">' . $element['#children'];
// Render file upload field using theme_form_element().
$output = theme('form_element', $element);
// Close "feeds-file" and "feeds-file-upload" divs.
$output .= '</div></div>';
return $output;
}