1.20.x file.module file_upload_validators_pre_render($element)

Pre-render callback for adding validation descriptions to file upload fields.

File

modules/file/file.module, line 2536
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_upload_validators_pre_render($element) {
  if (!empty($element['#upload_validators'])) {
    if (!isset($element['#description'])) {
      $element['#description'] = '';
    }
    if ($element['#description'] !== FALSE) {
      $element['#description'] = theme('file_upload_help', array(
        'description' => $element['#description'],
        'upload_validators' => $element['#upload_validators'],
      ));
    }
  }

  return $element;
}