Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
315
Merge Requests
315
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
5e83b6c6
Commit
5e83b6c6
authored
Dec 04, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2363077
by stefan.korn, eojthebrave: Max and min resolution not working
parent
1193f675
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
+2
-2
core/modules/image/src/Tests/ImageFieldDisplayTest.php
core/modules/image/src/Tests/ImageFieldDisplayTest.php
+8
-0
No files found.
core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
View file @
5e83b6c6
...
...
@@ -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'
),
...
...
core/modules/image/src/Tests/ImageFieldDisplayTest.php
View file @
5e83b6c6
...
...
@@ -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.'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment