Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
drupal
Commits
00b6a1fe
Commit
00b6a1fe
authored
Jul 21, 2016
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Issue
#2762953
by cilefen, gisle, drumm: Select elements should use strict comparison"
This reverts commit
2893aec5
.
parent
3f1ad36a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
44 deletions
+1
-44
core/includes/form.inc
core/includes/form.inc
+1
-1
core/modules/options/src/Tests/OptionsWidgetsTest.php
core/modules/options/src/Tests/OptionsWidgetsTest.php
+0
-43
No files found.
core/includes/form.inc
View file @
00b6a1fe
...
...
@@ -113,7 +113,7 @@ function form_select_options($element, $choices = NULL) {
$option
=
[];
$key
=
(
string
)
$key
;
$empty_choice
=
$empty_value
&&
$key
==
'_none'
;
if
(
$value_valid
&&
((
!
$value_is_array
&&
(
string
)
$element
[
'#value'
]
===
$key
||
(
$value_is_array
&&
in_array
(
$key
,
$element
[
'#value'
]
,
TRUE
)))
||
$empty_choice
))
{
if
(
$value_valid
&&
((
!
$value_is_array
&&
(
string
)
$element
[
'#value'
]
===
$key
||
(
$value_is_array
&&
in_array
(
$key
,
$element
[
'#value'
])))
||
$empty_choice
))
{
$option
[
'selected'
]
=
TRUE
;
}
else
{
...
...
core/modules/options/src/Tests/OptionsWidgetsTest.php
View file @
00b6a1fe
...
...
@@ -325,49 +325,6 @@ function testSelectListSingle() {
$edit
=
array
(
'card_1'
=>
'_none'
);
$this
->
drupalPostForm
(
'entity_test/manage/'
.
$entity
->
id
()
.
'/edit'
,
$edit
,
t
(
'Save'
));
$this
->
assertFieldValues
(
$entity_init
,
'card_1'
,
array
());
// Create field storage with string keys.
$field_storage
=
FieldStorageConfig
::
create
([
'field_name'
=>
'select_a'
,
'entity_type'
=>
'entity_test'
,
'type'
=>
'list_string'
,
'cardinality'
=>
1
,
'settings'
=>
[
'allowed_values'
=>
[
'7.50'
=>
'7.50'
,
'7.5'
=>
'7.5'
,
],
],
]);
$field_storage
->
save
();
// Create a list_string field instance.
$field
=
FieldConfig
::
create
([
'field_storage'
=>
$field_storage
,
'bundle'
=>
'entity_test'
,
'required'
=>
TRUE
,
]);
$field
->
save
();
entity_get_form_display
(
'entity_test'
,
'entity_test'
,
'default'
)
->
setComponent
(
$field_storage
->
getName
(),
array
(
'type'
=>
'options_select'
,
))
->
save
();
// Create and save an entity.
$entity
=
EntityTest
::
create
(
array
(
'user_id'
=>
1
,
'name'
=>
$this
->
randomMachineName
(),
));
$entity
->
save
();
// Ensure string keys are properly marked selected.
$this
->
drupalGet
(
'entity_test/manage/'
.
$entity
->
id
()
.
'/edit'
);
$edit
=
array
(
'select_a'
=>
'7.50'
);
$this
->
drupalPostForm
(
'entity_test/manage/'
.
$entity
->
id
()
.
'/edit'
,
$edit
,
t
(
'Save'
));
$this
->
assertFieldValues
(
$entity
,
'select_a'
,
array
(
'7.50'
));
$this
->
assertOptionSelected
(
'edit-select-a'
,
'7.50'
);
$this
->
assertNoOptionSelected
(
'edit-select-a'
,
'7.5'
);
}
/**
...
...
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