Skip to content

Adds a map selector UI form component for Xperience by Kentico admin site. Can be used for content type fields and page builder widget fields.

License

Notifications You must be signed in to change notification settings

liamgold/xperience-community-map-location-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xperience Community: Map Location Selector

Description

Adds a map selector UI form component for Xperience by Kentico admin site. Can be used for content type fields and page builder widget fields.

Screenshots

The UI form component can be used for fields on a content type, and renders like this on the content tab: Map location selector in content type

The component can also be used for widget properties and looks like this on the widget configuration window: Map location selector in widget

Supported version

Xperience by Kentico >= 28.2.0

Dependencies

Package Installation

Add the package to your application using the .NET CLI

dotnet add package XperienceCommunity.MapLocationSelector

Quick Start

  1. Install NuGet package above.

  2. Add configuration block to the ASP.NET Core appsettings.json file:

    "xperiencecommunity.maplocation": {
        "MapLatitude": "<your default latitude, e.g. 53.799009663238486>",
        "MapLongitude": "<your default longitude, e.g. -1.549048364271424>"
    }
  3. Register the configuration block using builder.Services.AddXperienceCommunityMapLocationSelector():

    // Program.cs
    
    var builder = WebApplication.CreateBuilder(args);
    
    // ...
    
    builder.Services.AddXperienceCommunityMapLocationSelector(builder.Configuration);

    At this point the UI form component will be registered for fields in content types.

    The value stored in the database when saved will either be an empty string (if no location selected), or in the format of 53.799009663238486,-1.549048364271424. The latitude and longitude are comma separated.

    If you need to use in widget properies too, then follow the next step to configure the widget.

  4. Use the MapLocationFormComponent attribute to add a property in your widget property configuration class.

    using XperienceCommunity.MapLocationSelector;
    
     public class ExampleWidgetProperties : IWidgetProperties
     {
         [MapLocationFormComponent(Label = "Location", Order = 1)]
         public string Location { get; set; }
     }

Contributing

Feel free to submit issues or pull requests to the repository, this is a community package and everyone is welcome to support.

License

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

About

Adds a map selector UI form component for Xperience by Kentico admin site. Can be used for content type fields and page builder widget fields.

Topics

Resources

License

Stars

Watchers

Forks