Skip to content
Snippets Groups Projects
Commit 59b3495a authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2041629 by tkoleary, mcrittenden, manningpete, superspring: Shorten...

Issue #2041629 by tkoleary, mcrittenden, manningpete, superspring: Shorten ridiculously long and verbose text in file upload field.
parent d2eb4bb4
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -452,20 +452,21 @@ function theme_file_upload_help($variables) {
if (strlen($description)) {
$descriptions[] = _filter_htmlcorrector($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($cardinality)) {
if ($cardinality == -1) {
$descriptions[] = t('Unlimited number of files can be uploaded to this field.');
}
else {
$descriptions[] = format_plural($cardinality, 'This field can store only one file.', 'This field can store at most @count files.');
$descriptions[] = format_plural($cardinality, 'One file only.', 'Maximum @count files.');
}
}
if (isset($upload_validators['file_validate_size'])) {
$descriptions[] = t('!size limit.', array('!size' => format_size($upload_validators['file_validate_size'][0])));
}
if (isset($upload_validators['file_validate_extensions'])) {
$descriptions[] = t('Allowed types: !extensions.', array('!extensions' => check_plain($upload_validators['file_validate_extensions'][0])));
}
if (isset($upload_validators['file_validate_image_resolution'])) {
$max = $upload_validators['file_validate_image_resolution'][0];
$min = $upload_validators['file_validate_image_resolution'][1];
......@@ -483,7 +484,7 @@ function theme_file_upload_help($variables) {
}
}
return implode('<br />', $descriptions);
return implode(' ', $descriptions);
}
/**
......
......@@ -165,8 +165,8 @@ function testImageFieldSettings() {
$instance = $this->createImageField($field_name, 'article', array(), $instance_settings, $widget_settings);
$this->drupalGet('node/add/article');
$this->assertText(t('Files must be less than 50 KB.'), 'Image widget max file size is displayed on article form.');
$this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), 'Image widget allowed file types displayed on article form.');
$this->assertText(t('50 KB limit.'), 'Image widget max file size is displayed on article form.');
$this->assertText(t('Allowed types: ' . $test_image_extension . '.'), 'Image widget allowed file types displayed on article form.');
$this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), 'Image widget allowed resolution displayed on article form.');
// We have to create the article first and then edit it because the alt
......
......@@ -5,7 +5,7 @@ field_uuid: 748beaea-5074-4ff2-b51c-28a643d37c3a
entity_type: node
bundle: article
label: Image
description: 'Upload an image to go with this article.'
description: ''
required: false
default_value: { }
default_value_function: ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment