From 21e6c75e7ccec415dcc1d5339b1a98ba289ab29d Mon Sep 17 00:00:00 2001 From: Evgenii Nikitin Date: Mon, 25 Oct 2021 17:26:10 +0300 Subject: [PATCH] EWPP-1050: Show Turkey address correctly. --- .../Field/FieldFormatter/AddressInlineFormatter.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/oe_theme_helper/src/Plugin/Field/FieldFormatter/AddressInlineFormatter.php b/modules/oe_theme_helper/src/Plugin/Field/FieldFormatter/AddressInlineFormatter.php index 576a04cbf..957348608 100644 --- a/modules/oe_theme_helper/src/Plugin/Field/FieldFormatter/AddressInlineFormatter.php +++ b/modules/oe_theme_helper/src/Plugin/Field/FieldFormatter/AddressInlineFormatter.php @@ -100,7 +100,13 @@ protected function viewElement(AddressInterface $address, $langcode) { else { $format_string = $address_format->getFormat() . "\n" . '%country'; } - $format_string = str_replace([',', ' - '], "\n", $format_string); + /* + * Remove extra characters from address format since address fields are + * optional. + * + * @see \CommerceGuys\Addressing\AddressFormat\AddressFormatRepository::getDefinitions() + */ + $format_string = str_replace([',', ' - ', '/'], "\n", $format_string); $items = $this->extractAddressItems($format_string, $address_elements);