Formatter
class Formatter extends DefaultFormatter (View source)
Properties
protected array | $defaultOptions | The default options. |
Methods
Customized method to get the administrative area's full name for US where they are stored as codes. Both formats work for mail but this is done to preserve backwards compatibility for c5 older versions which print out the state's full name in the address.
Modified version of DefaultFormatter::getValues().
Gets the subdivision's name value.
Details
protected array
buildView(AddressInterface $address, AddressFormat $addressFormat, array $options)
Customized method to get the administrative area's full name for US where they are stored as codes. Both formats work for mail but this is done to preserve backwards compatibility for c5 older versions which print out the state's full name in the address.
In addition to the default formatter, this adds the following options with the following possibilities:
- subdivision_names - Return the subdivision names in the
return array. By default these are with the default locale as defined
for the country for which the subdivisions belong to.
- Type: boolean
- Default: true
Since the subdivisions can be translated for each country, this modification only applies in case the 'locale' option has the English language.
{@inheritdoc}
protected array
getSubdivisionValuesWithNames(AddressInterface $address, AddressFormat $addressFormat)
Modified version of DefaultFormatter::getValues().
This only gets the subdivision values and possibly converts the normally returned codes to subdivision names.
protected string|null
getSubdivisionNameValue(AddressInterface $address, Subdivision $subdivision)
Gets the subdivision's name value.