diff --git a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php index bc050f79914d35a739be50ebe6d1980538da9310..6d1c149a1f0877d72b0c7e12c393242eaabf2835 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 ca9cf286b28a93802564d01dc5adcea6658d5a68..b73c06f482e7038096267eaa3a112a4dfddba6df 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -205,6 +205,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.');