- Issue created by @makbay
- Merge request !262Check if locality exists to prevent redundant comma. Add forgotten "-" to... → (Open) created by makbay
The address-plain.html.twig
template adds an unnecessary comma to the generated address text when the locality
variable does not have a value. This happens because the template only checks if locality
is not iterable ({% elseif locality is not iterable %}
), without verifying if the variable contains any value.
This leads to formatting issues in the address, resulting in output such as:
, Ankara, Turkey
The extra comma is unnecessary and affects the presentation of the address.
address-plain.html.twig
template to render an address.locality
variable is empty.locality
field.
Update the condition for rendering locality
to:
locality
exists.locality
is iterable and contains elements.
The corrected code for the locality
block could look like this:
{% if locality.name %} {{- locality.name -}}, {% elseif locality.code %} {{- locality.code -}}, {% elseif locality and locality is not iterable %} {{- locality -}}, {% endif %}
This ensures that locality
is only rendered when it has a valid value, avoiding unnecessary commas.
address-plain.html.twig
template with the proposed changes.None.
None.
None.
Needs review
12.4
Code (back-end)