Résumé de l'IA
Description
Le wpforms_geolocation_map_zoom est utilisé pour modifier le niveau de zoom par défaut de la carte utilisée dans l'application Géolocalisation addon.
Paramètres
- $zoom
- (int) Niveau de zoom pour la vue d'entrée.
- $contexte
- (int) Niveau de zoom pour la vue du formulaire.
Source
wpforms-geolocation/src/Map.php
Plus d'informations
Le wpforms_geolocation_map_zoom peut être utilisé pour modifier le niveau de zoom par défaut de la carte affichée dans l'entrée et dans le formulaire à l'aide du filtre Géolocalisation addon.
Exemple
/**
* Alter default zoom level of the maps on entries and forms using the Geolocation addon.
*
* @link https://wpforms.com/developers/wpforms_geolocation_map_zoom/
*
* @param int $zoom The zoom level for the entry view.
* @param int $zoom The zoom level for the form view.
*
* @return int
*/
function wpf_wpforms_geolocation_map_zoom( $zoom, $context ) {
// This will change the zoom level while viewing the entry.
if ( 'entry' === $context ) {
return 10;
}
// This will change the zoom level on the map that displays on the form above/under the Address field.
if ( 'field' === $context ) {
return 15;
}
return $zoom;
}
add_filter( 'wpforms_geolocation_map_zoom', 'wpf_wpforms_geolocation_map_zoom', 10, 2 );
En rapport
Documentation de référence : Comment modifier l'emplacement par défaut du module complémentaire de géolocalisation