Add support addressfield.

Comments

GemQueen’s picture

I added this code to track_field_changes_ccompare_field and so far it seems to work. After I get this tested I'll make a patch.

      case 'addressfield':
        for ($i = 0; $i < count($new_field); $i++) {
          //do a compare of each part of address field
          // first get a list of the address parts
          $address_items = array_keys($new_field[$i]);  // use $new_field in case something has change in the address definition
          foreach ($address_items as $address_item) {
            if ( $address_item <> 'data' ) {
              if ( empty($new_field[$i][$address_item] ) ) {
                if ( array_key_exists($address_item, $old_field[$i]) ) {
                  if ( ! empty($old_field[$i][$address_item]) ) {
                    return FALSE;
                  }
                } else {
                  return FALSE;
                }
              } else {
                if ( empty($old_field[$i][$address_item]) ) {
                  return FALSE;
                } else {
                  if ( $old_field[$i][$address_item] <> $new_field[$i][$address_item] ) {
                    return FALSE;
                  }
                }
              }
            }
          }
        }
        // if we made it this far, no changes
        return TRUE;
MattWithoos’s picture

Status: Active » Closed (fixed)

Thanks GemQueen, have tested and confirmed it's working. Will be arriving in 7.x-1.6

GemQueen’s picture

I don't think this made it in - I just downloaded 7.x-1.6 and unless I'm missing something, the addressfield code isn't there.

MattWithoos’s picture

Following on from the issue whereby people's contributions did not appear in the 1.6 release, I can confirm I have readded this for inclusion in 1.7.