Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
field_collection
Commits
9c147c3c
Commit
9c147c3c
authored
Mar 18, 2014
by
git
Committed by
jmuzz
Mar 18, 2014
Browse files
Issue #2123559 by jasonn1234: Fixed form_state on javascript remove button.
parent
8d61cee0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
field_collection.module
field_collection.module
+5
-3
No files found.
field_collection.module
View file @
9c147c3c
...
...
@@ -1524,9 +1524,9 @@ function field_collection_remove_js() {
* When a remove button is submitted, we need to find the item that it
* referenced and delete it. Since field UI has the deltas as a straight
* unbroken array key, we have to renumber everything down. Since we do this
* we *also* need to move all the deltas around in the $form_state['values']
*
and
$form_state['input'] so that user changed values
follow. This is a bit
* of a complicated process.
* we *also* need to move all the deltas around in the $form_state['values']
,
* $form_state['input']
, and $form_state['field']
so that user changed values
*
follow. This is a bit
of a complicated process.
*/
function
field_collection_remove_submit
(
$form
,
&
$form_state
)
{
$button
=
$form_state
[
'triggering_element'
];
...
...
@@ -1552,6 +1552,7 @@ function field_collection_remove_submit($form, &$form_state) {
$moving_element
=
drupal_array_get_nested_value
(
$form
,
$old_element_address
);
$moving_element_value
=
drupal_array_get_nested_value
(
$form_state
[
'values'
],
$old_element_address
);
$moving_element_input
=
drupal_array_get_nested_value
(
$form_state
[
'input'
],
$old_element_address
);
$moving_element_field
=
drupal_array_get_nested_value
(
$form_state
[
'field'
][
'#parents'
],
$old_element_address
);
// Tell the element where it's being moved to.
$moving_element
[
'#parents'
]
=
$new_element_address
;
...
...
@@ -1559,6 +1560,7 @@ function field_collection_remove_submit($form, &$form_state) {
// Move the element around.
form_set_value
(
$moving_element
,
$moving_element_value
,
$form_state
);
drupal_array_set_nested_value
(
$form_state
[
'input'
],
$moving_element
[
'#parents'
],
$moving_element_input
);
drupal_array_set_nested_value
(
$form_state
[
'field'
][
'#parents'
],
$moving_element
[
'#parents'
],
$moving_element_field
);
// Move the entity in our saved state.
if
(
isset
(
$field_state
[
'entity'
][
$i
+
1
]))
{
...
...
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