From 30d7f0f807d11df068267f15b7311f28ff9eb81e Mon Sep 17 00:00:00 2001 From: Joe Shindelar Date: Sat, 1 Nov 2014 11:04:52 -0600 Subject: [PATCH] [#2363077] Min/max resolution settings for image fields not being retrieved after save. --- core/modules/image/src/Plugin/Field/FieldType/ImageItem.php | 4 ++-- core/modules/image/src/Tests/ImageFieldDisplayTest.php | 8 ++++++++ 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 24c3927..dbb8fcd 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 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { $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 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#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 c49af3c..c56373f 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -182,6 +182,14 @@ function testImageFieldSettings() { ); $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.'); -- 1.8.3.4