Commit f965e896 authored by thtas's avatar thtas Committed by bojanz

Issue #2961594 by thtas, bojanz: Don't use form render elements in the formatters

parent fefa5330
......@@ -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)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment