Address Field from a code perspective

Last updated on
30 April 2025

For those who develop code, the address appears in the database as a field added with an array containing the address components. You might want these details if you are creating an import module or are diagnosing something at the database level.

If you add Address with the machine name box containing address, you end up with a Field field named field_address. The actual address is an array at field_address['und'][0].

The following dump was created by adding an address, selecting country Australia, then typing the names of each address box in the box. The result will vary by country. There are current issues to fix the address formatting and validation for several countries. Please test for your country.

["field_address"] =>  array(1) {
    ["und"] => array(1) {
      [0] => array(14) {
        ["country"] => string(2) "AU"
        ["administrative_area"] => string(5) "State"
        ["sub_administrative_area"] => NULL
        ["locality"] => string(4) "City"
        ["dependent_locality"] => NULL
        ["postal_code"] => string(11) "Postal Code"
        ["thoroughfare"] => string(9) "Address 1"
        ["premise"] => string(9) "Address 2"
        ["sub_premise"] => NULL
        ["organisation_name"] => NULL
        ["name_line"] => NULL
        ["first_name"] => NULL
        ["last_name"] => NULL
        ["data"] => NULL
      }
    }
  }

Help improve this page

Page status: Not set

You can: