CRM_Utils_Address
in package
Address Utilities
Tags
Table of Contents
Methods
- format() : string
- Format an address string from address fields and a format string.
- formatVCard() : string
- Format an address in the vcard format.
- getDefaultDistanceUnit() : string
- getFormattedBillingAddressFieldsFromParameters() : string
- Extract the billing fields from the form submission and format them for display.
- sequence() : array<string|int, mixed>
- addLabelFields() : void
- getDomainCountryToHide() : string|null
- Check if we should remove the domain contact's country from mailing labels and return it or null if not
Methods
format()
Format an address string from address fields and a format string.
public
static format(array<string|int, mixed> $fields[, string $format = null ][, false $ignore = false ][, false $unused = false ][, array<string|int, string> $tokenFields = null ]) : string
Format an address basing on the address fields provided. Use Setting's address_format if there's no format specified.
This function is also used to generate a contact's display_name and sort_name.
Parameters
- $fields : array<string|int, mixed>
-
The address fields.
- $format : string = null
-
The desired address format.
- $ignore : false = false
-
Should always be false.
- $unused : false = false
-
Should ALWAYS be false.
- $tokenFields : array<string|int, string> = null
Return values
string —formatted address string
formatVCard()
Format an address in the vcard format.
public
static formatVCard(array<string|int, mixed> $address) : string
Parameters
- $address : array<string|int, mixed>
-
The address fields - this should be at minimum the fields that would be retrieved from an apiv4 Contact.get call. It could be augmented with other fields (e.g if country_id.world_region:label is already known).
Return values
string —formatted address string
getDefaultDistanceUnit()
public
static getDefaultDistanceUnit() : string
Return values
stringgetFormattedBillingAddressFieldsFromParameters()
Extract the billing fields from the form submission and format them for display.
public
static getFormattedBillingAddressFieldsFromParameters(array<string|int, mixed> $params) : string
Parameters
- $params : array<string|int, mixed>
Return values
stringsequence()
public
static sequence(string $format) : array<string|int, mixed>
Parameters
- $format : string
Return values
array<string|int, mixed>addLabelFields()
private
static addLabelFields(array<string|int, mixed> &$address, bool $isResolveWorldRegion) : void
Parameters
- $address : array<string|int, mixed>
- $isResolveWorldRegion : bool
Tags
getDomainCountryToHide()
Check if we should remove the domain contact's country from mailing labels and return it or null if not
private
static getDomainCountryToHide() : string|null