Skip to content

Xperience by Kentico Google Maps integration allows users to add an address input field with validation and autocomplete to their websites via a new form component using the Forms application.

License

Notifications You must be signed in to change notification settings

Kentico/xperience-by-kentico-google-maps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xperience by Kentico Google Maps

Kentico Labs CI: Build and Test

Description

Xperience by Kentico Google Maps integration allows users to add an address input field with validation and autocomplete to their websites via a new form component using the Forms application.

Screenshots

Google Maps autocomplete on live site

Library Version Matrix

Xperience Version Library Version
>= 29.0.3 1.0.0

Dependencies

Package Installation

This integration is not yet distributed as a NuGet package.

You can add it to your project by cloning the repository and referencing the src/Kentico.Xperience.GoogleMaps/Kentico.Xperience.GoogleMaps.csproj project in your solution

Quick Start

The integration uses Google Cloud console APIs, which must be configured together with your Xperience project when setting up the integration.

Google Cloud Setup

  1. Sign in to Google Cloud console. You will need to create a Google account if you don't already have one.
  2. Create a new Google Cloud project.
  3. Enable the following APIs:
  4. Create an API key for your project. You will later use this key when configuring the Google Maps integration in your Xperience project.

Integration Setup

  1. In Program.cs, call the AddXperienceGoogleMaps method with the builder.Configuration parameter when registering services into the application's service container. The method must be called after AddKentico.

     WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
     builder.Services.AddKentico();
     builder.Services.AddXperienceGoogleMaps(builder.Configuration);
  2. Add the following configuration keys to your application's configuration providers (appsettings.json by default). Use the API you generated for your Google Cloud console project in the previous steps.

    "CMSXperienceGoogleMaps": {
      "APIKey": "<Google Maps API key>"
    }
  3. The integration provides a <google-maps /> Razor Tag Helper that includes the scripts and styles necessary for the integration to function. Include the Tag Helper to a suitable location in your Razor view hierarchy using the @addTagHelper directive. Add the Tag Helper to your top-level _ViewImports.cshtml file to make it available everywhere.

    @using Kentico.Xperience.GoogleMaps
    @addTagHelper *, Kentico.Xperience.GoogleMaps
  4. Place the <google-maps /> Tag Helper in the <head> tag of your page's HTML structure as defined by your Razor layout hierarchy. The Tag Helper must be placed everywhere where forms that use the address autocomplete form component are rendered.

    <google-maps />

Customization of Autocomplete panel

To customize the appearance of the autocomplete panel, you can use the following CSS classes:

  • xperience-address-dropdown - the main container of the autocomplete dropdown
  • xperience-address-dropdown-item - the container of each item in the dropdown
  • xperience-address-dropdown-item:hover - the hover effect of the dropdown item
  • xperience-address-dropdown-item.active - the active item in the dropdown
  • xperience-address-dropdown-item-logo - the container of the Google Maps logo dropdown item

Keep in mind Google's usage policies.

Contributing

To see the guidelines for Contributing to Kentico open source software, please see Kentico's CONTRIBUTING.md for more information and follow the Kentico's CODE_OF_CONDUCT.

Instructions and technical details for contributing to this project can be found in Contributing Setup.

License

Distributed under the MIT License. See LICENSE.md for more information.

Support

Kentico Labs

This project has Kentico Labs limited support.

See SUPPORT.md for more information.

For any security issues see SECURITY.md.

About

Xperience by Kentico Google Maps integration allows users to add an address input field with validation and autocomplete to their websites via a new form component using the Forms application.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •