You are here

function hook_uc_addresses_address_field_alter in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 uc_addresses.api.php \hook_uc_addresses_address_field_alter()

This hook allows to you alter a uc_addresses_address field element.

This is useful if you want to make a change to address edit forms that's applyable for all places it appears.

The address object the field element is for can be find in: $element['#uc_addresses_address']

Parameters

array $element: The form element, contains several subfields.

Return value

void

1 invocation of hook_uc_addresses_address_field_alter()
uc_addresses_process_address_field in ./uc_addresses.module
Element process hook for address fields.

File

./uc_addresses.api.php, line 143
These hooks are invoked by the Ubercart Addresses module. @todo more documentation needed for hook_uc_addresses_field_handlers(). @todo Document the rest of the API.

Code

function hook_uc_addresses_address_field_alter(&$element) {

  // Add extra validation if the address of this element is a default billing address
  $address = $element['#uc_addresses_address'];
  if ($address
    ->isDefault('billing')) {
    $element['#element_validate'][] = 'mymodule_uc_addresses_address_validate';
  }
}