geolocation-8.x-3.x-dev/modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/PhotonGermany.php

modules/geolocation_leaflet/src/Plugin/geolocation/GeocoderCountryFormatting/PhotonGermany.php
<?php

namespace Drupal\geolocation_leaflet\Plugin\geolocation\GeocoderCountryFormatting;

use Drupal\geolocation\Attribute\GeocoderCountryFormatting;
use Drupal\geolocation_leaflet\NominatimRoadFirstFormattingBase;

/**
 * Provides address formatting.
 */
#[GeocoderCountryFormatting(
  id: 'photon_de',
  countryCode: 'de',
  geocoder: 'photon'
)]
class PhotonGermany extends NominatimRoadFirstFormattingBase {

  /**
   * {@inheritdoc}
   */
  public function format(array $atomics): ?array {
    $address_elements = parent::format($atomics);
    if (
      empty($address_elements['locality'])
      && !empty($atomics['state'])
    ) {
      $address_elements['locality'] = $atomics['state'];
    }
    return $address_elements;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc