summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-12-04 11:05:04 (GMT)
committerAlex Pott2014-12-04 11:05:04 (GMT)
commit5e83b6c6e340c7d858896c72214a25ed5e68f30e (patch)
tree4d8b655c4722f85b9a5877a2a2e6b7ad8c7b2b59
parent1193f6758a1d24ea15e0c7a7a7241f7a8c1c0a3f (diff)
Issue #2363077 by stefan.korn, eojthebrave: Max and min resolution not working
-rw-r--r--core/modules/image/src/Plugin/Field/FieldType/ImageItem.php4
-rw-r--r--core/modules/image/src/Tests/ImageFieldDisplayTest.php8
2 files changed, 10 insertions, 2 deletions
diff --git a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
index bc050f79..6d1c149 100644
--- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
+++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
@@ -196,7 +196,7 @@ class ImageItem extends FileItem {
$settings = $this->getSettings();
// Add maximum and minimum resolution settings.
- $max_resolution = explode('×', $settings['max_resolution']) + array('', '');
+ $max_resolution = explode('x', $settings['max_resolution']) + array('', '');
$element['max_resolution'] = array(
'#type' => 'item',
'#title' => t('Maximum image resolution'),
@@ -223,7 +223,7 @@ class ImageItem extends FileItem {
'#field_suffix' => ' ' . t('pixels'),
);
- $min_resolution = explode('×', $settings['min_resolution']) + array('', '');
+ $min_resolution = explode('x', $settings['min_resolution']) + array('', '');
$element['min_resolution'] = array(
'#type' => 'item',
'#title' => t('Minimum image resolution'),
diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
index ca9cf28..b73c06f 100644
--- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
@@ -205,6 +205,14 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
);
$field = $this->createImageField($field_name, 'article', array(), $field_settings, $widget_settings);
+ // Verify that the min/max resolution set on the field are properly
+ // extracted, and displayed, on the image field's configuration form.
+ $this->drupalGet('admin/structure/types/manage/article/fields/' . $field->id());
+ $this->assertFieldByName('field[settings][max_resolution][x]', '100', 'Expected max resolution X value of 100.');
+ $this->assertFieldByName('field[settings][max_resolution][y]', '100', 'Expected max resolution Y value of 100.');
+ $this->assertFieldByName('field[settings][min_resolution][x]', '10', 'Expected min resolution X value of 10.');
+ $this->assertFieldByName('field[settings][min_resolution][y]', '10', 'Expected min resolution Y value of 10.');
+
$this->drupalGet('node/add/article');
$this->assertText(t('50 KB limit.'), 'Image widget max file size is displayed on article form.');
$this->assertText(t('Allowed types: @extensions.', array('@extensions' => $test_image_extension)), 'Image widget allowed file types displayed on article form.');