Address Field Sub Premise
Categories
Component ID
2400945
Component name
Address Field Sub Premise
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
3976
Component created
Component changed
Component body
Address Field module provide default API to store compatible xNAL standard postal address.
However, some fields are not completely implemented such as "sub premise" which is sometimes used a the third street address field.
Thanks to plugin API, Address Field Sub Premise provides the missing part.
Setup
This module provide the missing form element.
However, you still need to alter country form declaration to specify which country should display this new field, and which one requires it.
- Install and enable this module
- Create a new field using the Address Field module(is necessary)
- In this setup field, enable the "Address form (country specific)"
- In this setup field, enable the "Address form extension (sub premise field support)" plugin
- Create a hook as followed
/**
* Implements hook_addressfield_address_formats_alter().
*/
function example_addressfield_address_formats_alter(&$address_formats) {
// Enable 'sub_premise' field.
$address_formats['US']['used_fields'][] = 'sub_premise';
// Set 'sub_premise' field as required.
$address_formats['US']['required_fields'][] = 'sub_premise';
// Set label.
$address_formats['US']['sub_premise_label'] = t('Address 3');
}
Compatibility notes
This module doesn't alter database schema. All necessary fields are already available via Address Field module.
