line 224 of the addressfield.module file

      if (isset($child['#prefix'])) {
        $child['#prefix'] = (isset($child['#prefix']) ? $child['#prefix'] : '') . $child['#prefix'];
      }

First of all that second "isset" can never return false so the statement isn't really necessary but most importantly if the prefix exists you always end you with two of them.

This means my addresses look like:
Starbucks, , 237 West Pender Street, , Vancouver, , BC

Comments

raychaser’s picture

StatusFileSize
new692 bytes

Here's a patch. This is my first drupal patch so let me know if I'm doing it wrong.

petsagouris’s picture

Status: Active » Needs review
cosmicdreams’s picture

Status: Needs review » Reviewed & tested by the community

Works awesomely

peterpoe’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new700 bytes

The patch in #1 removes any #field_prefix. This should be a proper fix.

peterpoe’s picture

StatusFileSize
new754 bytes

Ops, forgot to change one line.

nodestroy’s picture

StatusFileSize
new776 bytes

i think there is something broken with your last patch. attached another version.

dasjo’s picture

Status: Needs review » Reviewed & tested by the community

patch in #6 works just fine and fixes the problem.

chaby’s picture

Thanks, seems that #5 is a better approach than #6 if you want to add #field_prefix property to the element, and want to suffix #prefix with it...
Anyway, maybe #field_prefix and #field_suffix aren't really usefull as most of the time, you could simply aggregate it into #prefix or #suffix directly (or override other elements) ... ?

johnv’s picture

Status: Reviewed & tested by the community » Needs review

There seems to be some dispute on the correct versions: #5 or #6, so I set the status back.

Also, #1232608: Don't duplicate addressfield element prefixes or use non-breaking space prefixes for inline elements contains the same patch and more, and has bigger audience. Should this issue be set as dulicate?

Garrett Albright’s picture

Status: Needs review » Closed (duplicate)