diff --git a/src/Plugin/Field/FieldFormatter/AddressPlainFormatter.php b/src/Plugin/Field/FieldFormatter/AddressPlainFormatter.php index 5c7753f..f9e033e 100644 --- a/src/Plugin/Field/FieldFormatter/AddressPlainFormatter.php +++ b/src/Plugin/Field/FieldFormatter/AddressPlainFormatter.php @@ -56,7 +56,7 @@ class AddressPlainFormatter extends FormatterBase implements ContainerFactoryPlu protected $subdivisionRepository; /** - * Constructs an AddressDefaultFormatter object. + * Constructs an AddressPlainFormatter object. * * @param string $pluginId * The plugin_id for the formatter. diff --git a/src/Tests/Formatter/PlainFormatterTest.php b/src/Tests/Formatter/PlainFormatterTest.php index 918e1c5..1867730 100644 --- a/src/Tests/Formatter/PlainFormatterTest.php +++ b/src/Tests/Formatter/PlainFormatterTest.php @@ -122,11 +122,10 @@ class PlainFormatterTest extends KernelTestBase { 'line3' => 'C. Prat de la Creu, 62-64', 'line4' => '', 'line5' => '', - 'line6' => 'Parròquia d'Andorra la Vella', + 'line6' => 'Andorra la Vella', 'line7' => 'AD500', - 'line8' => 'Andorra la Vella', - 'line9' => '', - 'line10' => 'Andorra', + 'line8' => '', + 'line9' => 'Andorra', ]); $this->assertRaw($expected); } @@ -160,9 +159,8 @@ class PlainFormatterTest extends KernelTestBase { 'line5' => '', 'line6' => '大安區', 'line7' => '106', - 'line8' => '大安區', - 'line9' => '台北市', - 'line10' => '台灣', + 'line8' => '台北市', + 'line9' => '台灣', ]); $this->assertRaw($expected); } @@ -188,9 +186,8 @@ class PlainFormatterTest extends KernelTestBase { 'line5' => '', 'line6' => '', 'line7' => '94043', - 'line8' => '', - 'line9' => 'CA', - 'line10' => 'United States', + 'line8' => 'CA', + 'line9' => 'United States', ]); $this->assertRaw($expected); @@ -205,11 +202,10 @@ class PlainFormatterTest extends KernelTestBase { 'line3' => '1098 Alta Ave', 'line4' => '', 'line5' => '', - 'line6' => '', + 'line6' => 'Mountain View', 'line7' => '94043', - 'line8' => 'Mountain View', - 'line9' => '', - 'line10' => 'United States', + 'line8' => '', + 'line9' => 'United States', ]); $this->assertRaw($expected); } diff --git a/templates/address-plain.html.twig b/templates/address-plain.html.twig index e2b1079..7e3c50c 100644 --- a/templates/address-plain.html.twig +++ b/templates/address-plain.html.twig @@ -31,9 +31,8 @@ {{ organization }} {{ address_line1 }} {{ address_line2 }} -{{ dependent_locality.code }} -{{ locality.code }} +{{ dependent_locality.name ?: dependent_locality }} +{{ locality.name ?: locality }} {{ postal_code }} -{{ locality.name }} -{{ administrative_area.code }} +{{ administrative_area.code ?: administrative_area }} {{ country.name }}