function theme_upload_element_file_description in Upload element 6
This theming function can be used to assign different text to the description that is found under the file HTML element.
Parameters
array $element FAPI upload element:
1 theme call to theme_upload_element_file_description()
- _upload_element_expand in ./
upload_element.module - Our #process callback to expand the control.
File
- ./
upload_element.module, line 616 - A module that provides two new elements to the FAPI for file handling.
Code
function theme_upload_element_file_description($element) {
// set file validation defaults for the theming functions
_upload_element_add_file_validators($element);
$validation_messages = array();
if (isset($element['#file_validators']['file_validate_extensions'])) {
$ext = _upload_element_allowed_extensions($element);
$validation_messages[] = t('Only files with the following extensions are allowed: %ext.', array(
'%ext' => implode(', ', $ext),
));
}
elseif (isset($element['#file_validators']['file_validate_is_image'])) {
$validation_messages[] = t('Only JPEG, PNG and GIF images are allowed.');
}
if (isset($element['#file_validators']['file_validate_size'])) {
$validation_messages[] = t('The maximum upload size is %filesize.', array(
'%filesize' => format_size($element['#file_validators']['file_validate_size'][0]),
));
}
$validation_messages[] = t('Changes made are not permanent until you save this form.');
$validator_seperator = isset($element['#file_validator_seperator']) ? $element['#file_validator_seperator'] : '<br />';
return implode($validator_seperator, $validation_messages);
}