You are here

function addressfield_format_address_optional in Address Field 7

Format callback.

See also

CALLBACK_addressfield_format_callback()

1 string reference to 'addressfield_format_address_optional'
address-optional.inc in plugins/format/address-optional.inc

File

plugins/format/address-optional.inc, line 21

Code

function addressfield_format_address_optional(&$format, $address, $context = array()) {
  if (isset($format['name_block'])) {
    if (isset($format['name_block']['name_line'])) {
      $format['name_block']['name_line']['#required'] = FALSE;
    }
    elseif (isset($format['name_block']['first_name'])) {
      $format['name_block']['first_name']['#required'] = FALSE;
      $format['name_block']['last_name']['#required'] = FALSE;
    }
  }
  $format['street_block']['thoroughfare']['#required'] = FALSE;
  $format['locality_block']['postal_code']['#required'] = FALSE;
  $format['locality_block']['dependent_locality']['#required'] = FALSE;
  $format['locality_block']['locality']['#required'] = FALSE;
  $format['locality_block']['administrative_area']['#required'] = FALSE;
}