function theme_file_upload_help

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 file.field.inc theme_file_upload_help($variables)
cle7 file.field.inc theme_file_upload_help($variables)
elmsmedia7 file.field.inc theme_file_upload_help($variables)
icor7 file.field.inc theme_file_upload_help($variables)
meedjum_blog7 file.field.inc theme_file_upload_help($variables)
mooc7 file.field.inc theme_file_upload_help($variables)

Returns HTML for help text based on file upload validators.

Parameters

$variables: An associative array containing:

  • description: The normal description for this field, specified by the user.
  • upload_validators: An array of upload validators as used in $element['#upload_validators'].

Related topics

5 theme calls to theme_file_upload_help()
file_entity_upload_validators_pre_render in sites/all/modules/ulmus/file_entity/file_entity.module
Pre-render callback for adding validation descriptions to file upload fields.
file_field_widget_form in modules/file/file.field.inc
Implements hook_field_widget_form().
image_field_widget_form in modules/image/image.field.inc
Implements hook_field_widget_form().
multiupload_filefield_widget_field_widget_form in sites/all/modules/ulmus/multiupload_filefield_widget/multiupload_filefield_widget.field.inc
Implements hook_field_widget_form().
multiupload_imagefield_widget_field_widget_form in sites/all/modules/ulmus/multiupload_imagefield_widget/multiupload_imagefield_widget.module
Implements hook_field_widget_form().
6 string references to the theme hook from theme_file_upload_help()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

file_entity_upload_validators_pre_render in sites/all/modules/ulmus/file_entity/file_entity.module
Pre-render callback for adding validation descriptions to file upload fields.
file_field_widget_form in modules/file/file.field.inc
Implements hook_field_widget_form().
file_theme in modules/file/file.module
Implements hook_theme().
image_field_widget_form in modules/image/image.field.inc
Implements hook_field_widget_form().
multiupload_filefield_widget_field_widget_form in sites/all/modules/ulmus/multiupload_filefield_widget/multiupload_filefield_widget.field.inc
Implements hook_field_widget_form().

... See full list

File

modules/file/file.field.inc, line 933
Field module functionality for the File module.

Code

function theme_file_upload_help($variables) {
  $description = $variables['description'];
  $upload_validators = $variables['upload_validators'];

  $descriptions = array();

  if (strlen($description)) {
    $descriptions[] = $description;
  }
  if (isset($upload_validators['file_validate_size'])) {
    $descriptions[] = t('Files must be less than !size.', array('!size' => '<strong>' . format_size($upload_validators['file_validate_size'][0]) . '</strong>'));
  }
  if (isset($upload_validators['file_validate_extensions'])) {
    $descriptions[] = t('Allowed file types: !extensions.', array('!extensions' => '<strong>' . check_plain($upload_validators['file_validate_extensions'][0]) . '</strong>'));
  }
  if (isset($upload_validators['file_validate_image_resolution'])) {
    $max = $upload_validators['file_validate_image_resolution'][0];
    $min = $upload_validators['file_validate_image_resolution'][1];
    if ($min && $max && $min == $max) {
      $descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
    }
    elseif ($min && $max) {
      $descriptions[] = t('Images must be between !min and !max pixels.', array('!min' => '<strong>' . $min . '</strong>', '!max' => '<strong>' . $max . '</strong>'));
    }
    elseif ($min) {
      $descriptions[] = t('Images must be larger than !min pixels.', array('!min' => '<strong>' . $min . '</strong>'));
    }
    elseif ($max) {
      $descriptions[] = t('Images must be smaller than !max pixels.', array('!max' => '<strong>' . $max . '</strong>'));
    }
  }

  return implode('<br />', $descriptions);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.