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
f965e896
Commit
f965e896
authored
Apr 30, 2018
by
Tim Hayward
Committed by
Bojan Živanović
Apr 30, 2018
Browse files
Issue
#2961594
by thtas, bojanz: Don't use form render elements in the formatters
parent
fefa5330
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Plugin/Field/FieldFormatter/AddressDefaultFormatter.php
View file @
f965e896
...
...
@@ -145,18 +145,9 @@ class AddressDefaultFormatter extends FormatterBase implements ContainerFactoryP
$address_format
=
$this
->
addressFormatRepository
->
get
(
$country_code
);
$values
=
$this
->
getValues
(
$address
,
$address_format
);
$element
=
[];
$element
[
'address_format'
]
=
[
'#type'
=>
'value'
,
'#value'
=>
$address_format
,
];
$element
[
'locale'
]
=
[
'#type'
=>
'value'
,
'#value'
=>
$address
->
getLocale
(),
];
$element
[
'country_code'
]
=
[
'#type'
=>
'value'
,
'#value'
=>
$country_code
,
$element
=
[
'#address_format'
=>
$address_format
,
'#locale'
=>
$address
->
getLocale
(),
];
$element
[
'country'
]
=
[
'#type'
=>
'html_tag'
,
...
...
@@ -195,8 +186,8 @@ class AddressDefaultFormatter extends FormatterBase implements ContainerFactoryP
*/
public
static
function
postRender
(
$content
,
array
$element
)
{
/** @var \CommerceGuys\Addressing\AddressFormat\AddressFormat $address_format */
$address_format
=
$element
[
'address_format'
]
[
'#value'
]
;
$locale
=
$element
[
'locale'
]
[
'#value'
]
;
$address_format
=
$element
[
'
#
address_format'
];
$locale
=
$element
[
'
#
locale'
];
// Add the country to the bottom or the top of the format string,
// depending on whether the format is minor-to-major or major-to-minor.
if
(
LocaleHelper
::
match
(
$address_format
->
getLocale
(),
$locale
))
{
...
...
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