public static function FieldHelper::getPropertyName in Address 8
Gets the property name matching the given AddressField value.
Parameters
string $field: An AddressField value.
Return value
string The property name.
5 calls to FieldHelper::getPropertyName()
- Address::addressElements in src/
Element/ Address.php - Builds the format-specific address elements.
- Address::processSubdivisionElements in src/
Element/ Address.php - Processes the subdivision elements, adding predefined values where found.
- AddressDefaultFormatter::viewElement in src/
Plugin/ Field/ FieldFormatter/ AddressDefaultFormatter.php - Builds a renderable array for a single address item.
- AddressItem::getProperties in src/
Plugin/ Field/ FieldType/ AddressItem.php - Gets an array of property objects.
- ZoneTerritory::buildSubdivisionElements in src/
Element/ ZoneTerritory.php - Builds the subdivision form elements.
File
- src/
FieldHelper.php, line 21
Class
- FieldHelper
- Provides property names and autocomplete attributes for AddressField values.
Namespace
Drupal\addressCode
public static function getPropertyName($field) {
$property_mapping = [
AddressField::ADMINISTRATIVE_AREA => 'administrative_area',
AddressField::LOCALITY => 'locality',
AddressField::DEPENDENT_LOCALITY => 'dependent_locality',
AddressField::POSTAL_CODE => 'postal_code',
AddressField::SORTING_CODE => 'sorting_code',
AddressField::ADDRESS_LINE1 => 'address_line1',
AddressField::ADDRESS_LINE2 => 'address_line2',
AddressField::ORGANIZATION => 'organization',
AddressField::GIVEN_NAME => 'given_name',
AddressField::ADDITIONAL_NAME => 'additional_name',
AddressField::FAMILY_NAME => 'family_name',
];
return isset($property_mapping[$field]) ? $property_mapping[$field] : NULL;
}