protected function MapLinkBase::addressString in Address Map (& Directions) Link 8
Builds a query for use in a url for a single address item.
Parameters
\Drupal\address\AddressInterface $address: The address.
Return value
string A query string.
11 calls to MapLinkBase::addressString()
- AppleMaps::getAddressUrl in src/
Plugin/ MapLink/ AppleMaps.php - Gets the map link url from an address.
- BingMaps::getAddressUrl in src/
Plugin/ MapLink/ BingMaps.php - Gets the map link url from an address.
- GoogleMaps::getAddressUrl in src/
Plugin/ MapLink/ GoogleMaps.php - Gets the map link url from an address.
- GoogleMapsDirections::getAddressUrl in src/
Plugin/ MapLink/ GoogleMapsDirections.php - Gets the map link url from an address.
- HereWeGoMaps::getAddressUrl in src/
Plugin/ MapLink/ HereWeGoMaps.php - Gets the map link url from an address.
File
- src/
MapLinkBase.php, line 43
Class
- MapLinkBase
- Base class for Map link plugins.
Namespace
Drupal\address_map_linkCode
protected function addressString(AddressInterface $address) {
$addressParameters = [];
if ($address
->getAddressLine1()) {
$addressParameters[] = $address
->getAddressLine1();
}
if ($address
->getAddressLine2()) {
$addressParameters[] = $address
->getAddressLine2();
}
if ($address
->getLocality()) {
$addressParameters[] = $address
->getLocality();
}
if ($address
->getAdministrativeArea()) {
$addressParameters[] = $address
->getAdministrativeArea();
}
if ($address
->getDependentLocality()) {
$addressParameters[] = $address
->getDependentLocality();
}
if ($address
->getPostalCode()) {
$addressParameters[] = $address
->getPostalCode();
}
if ($address
->getCountryCode()) {
$addressParameters[] = $address
->getCountryCode();
}
return implode(' ', $addressParameters);
}