Outils pour utilisateurs

Outils du site


informatique:wordpress:acf:acf-openstreetmap-field

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
informatique:wordpress:acf:acf-openstreetmap-field [24/12/2024 12:40] – [Surcharge de la Localisation du résultat] cyrilleinformatique:wordpress:acf:acf-openstreetmap-field [25/12/2024 21:56] (Version actuelle) – [different geocoders] cyrille
Ligne 13: Ligne 13:
   * [[https://github.com/mcguffin/acf-openstreetmap-field/issues/71|Other library nominatim to geocoder]]   * [[https://github.com/mcguffin/acf-openstreetmap-field/issues/71|Other library nominatim to geocoder]]
  
-==== Surcharge de la Localisation du résultat ====+Étude ... 
 +<code javascript> 
 +// plugin view 
 +// in wp-content/plugins/acf-openstreetmap-field/src/js/lib/media/views/map-input.js 
 +initGeocode() { 
 + geocoder_options Object.assign({ 
 +  ... 
 +  geocoder: L.Control.Geocoder.nominatim( nominatim_options ) 
 + this.geocoder L.Control.geocoder( geocoder_options )
  
 +// tests
 +// in wp-content/plugins/acf-openstreetmap-field/test/js/address.js
 +mapDrawCenter(){
 + const geocoder      = L.Control.Geocoder.nominatim()
  
-  * Issue https://github.com/mcguffin/acf-openstreetmap-field/issues/128 +</code>
-  * PR https://github.com/mcguffin/acf-openstreetmap-field/pull/129+
  
 +Les geocoders de [[https://github.com/perliedman/leaflet-control-geocoder|leaflet-control-geocoder]] n'ont pas tous l'option ''htmlTemplate'' :-(
 +  * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.NominatimOptions.html#htmltemplate|Nominatim htmlTemplate]]
 +  * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.PhotonOptions.html#htmltemplate|Photon htmlTemplate]]
  
-In ''‎include/ACFFieldOpenstreetmap/Core/Core.php''+Geocoder options 
 +  * [[https://www.liedman.net/leaflet-control-geocoder/docs/classes/geocoders.Openrouteservice.html#options|Openrouteservice options]] 
 +    * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.PeliasOptions.html|PeliasOptions]] 
 +  * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.OpenCageOptions.html|OpenCageOptions]]
  
-Override geocode results format translation in wp-config+==== Surcharge de la Localisation du résultat ==== 
 + 
 +  * Issue https://github.com/mcguffin/acf-openstreetmap-field/issues/128 
 +  * PR https://github.com/mcguffin/acf-openstreetmap-field/pull/129 
 + 
 +In ''‎include/ACFFieldOpenstreetmap/Core/Core.php'' override geocode results format translation with ''constants in wp-config.php'' or with ''acf_osm_address_format'' WP filter.
  
 Geocode results format are set with translation for localisation. But in some case we want specific formats. Geocode results format are set with translation for localisation. But in some case we want specific formats.
Ligne 33: Ligne 55:
 define('ACF_OSM_I18N_ADDR_COUNTRY',''); define('ACF_OSM_I18N_ADDR_COUNTRY','');
 </code> </code>
 +
 +Or with a filter in ''functions.php'' or somewhere else :
  
 <code php> <code php>
-'address_format=> [ +add_filter('acf_osm_address_format', function($format){ 
- 'street' => defined('ACF_OSM_I18N_ADDR_STREET'+ $format['street'= 'from filter: {building} {road} {house_number}' ; 
-   ? constant('ACF_OSM_I18N_ADDR_STREET'+ return $format ; 
-   __( '{building} {road} {house_number}' +} );
-   , 'acf-openstreetmap-field' ), +
- 'city' => defined('ACF_OSM_I18N_ADDR_CITY'+
-   ? constant('ACF_OSM_I18N_ADDR_CITY'+
-   : __( '{postcode{city} {town} {village} {hamlet}' +
-   , 'acf-openstreetmap-field' )+
- 'country' => defined('ACF_OSM_I18N_ADDR_COUNTRY'+
-   ? constant('ACF_OSM_I18N_ADDR_COUNTRY'+
-   : __( '{state} {country}' +
-   , 'acf-openstreetmap-field' )   +
-]+
 </code> </code>
  
informatique/wordpress/acf/acf-openstreetmap-field.1735040435.txt.gz · Dernière modification : 24/12/2024 12:40 de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki