Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
address
Commits
20e725de
Commit
20e725de
authored
Jul 01, 2017
by
Derek Wright
Committed by
Bojan Živanović
Jul 01, 2017
Browse files
Issue
#2889734
by dww, lukedekker, bojanz: Incorrect Ajax substitution for predefined subdivisions
parent
49602451
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Element/Address.php
View file @
20e725de
...
...
@@ -334,8 +334,15 @@ class Address extends FormElement {
* Ajax callback.
*/
public
static
function
ajaxRefresh
(
array
$form
,
FormStateInterface
$form_state
)
{
$country_element
=
$form_state
->
getTriggeringElement
();
$address_element
=
NestedArray
::
getValue
(
$form
,
array_slice
(
$country_element
[
'#array_parents'
],
0
,
-
2
));
$triggering_element
=
$form_state
->
getTriggeringElement
();
$parents
=
$triggering_element
[
'#array_parents'
];
$triggering_element_name
=
array_pop
(
$parents
);
// The country_code element is nested one level deeper than
// the subdivision elements.
if
(
$triggering_element_name
==
'country_code'
)
{
array_pop
(
$parents
);
};
$address_element
=
NestedArray
::
getValue
(
$form
,
$parents
);
return
$address_element
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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