While creating a format plugin I was comma separating some of the field values and they were duplicating. Tracing it back, I found on lines 224 of addressfield.module the child prefix is duplicated.

Is that supposed to be field_prefix appending? The suffix is appending with a field_suffix just below.

Comments

jcmiller09’s picture

same exact problem. did you try patching or altering the code?
changing lines 224-230 to this fixed the duplication for me.

      // Add #prefix and #field_suffix to the prefixes and suffixes.
      if (isset($child['#field_prefix'])) {
        $child['#prefix'] = (isset($child['#prefix']) ? $child['#prefix'] : '') . $child['#prefix'];
      }
      if (isset($child['#field_suffix'])) {
        $child['#suffix'] = (isset($child['#suffix']) ? $child['#suffix'] : '') . $child['#suffix'];
      }
joelpittet’s picture

I can't see a reason why the prefix or suffix is getting duplicated in the first place, or even concatenating the field_suffix. Should let the developer do that is what is needed. Personally, I changed my code from prefix to suffix, or which one did what I wanted to get around the issue.

helior’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #1410612: Double #prefix problem. And rest assured.. there is a patch ;)

joelpittet’s picture

Status: Closed (duplicate) » Needs review

It is the same issue I believe but the question still remains on the purpose behind that duplication of the prefixes and the inconsistency between the logic on the suffix and prefix.

johnv’s picture

Status: Needs review » Closed (duplicate)

@joelpittet, that question will be in everybody's head struggling with this very issue. It is better regarded in the existing issues:
#1232608: Don't duplicate addressfield element prefixes or use non-breaking space prefixes for inline elements
#1410612: Double #prefix problem

P.S. Status 'needs review' is only for issues with 'real' patches.