Commit 5e83b6c6 authored by alexpott's avatar alexpott

Issue #2363077 by stefan.korn, eojthebrave: Max and min resolution not working

parent 1193f675
......@@ -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'),
......
......@@ -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.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment