Was this page helpful?

Customize the location field editor

This article explains how to customize the appearance of the location field editor in the Contentful web app using the App Framework.

Overview

The location field editor enables you to select and store geographic coordinates using a visual interface powered by the Google Maps API. To function, it requires a Google API Key.

Default location field editor

The default location field editor receives a Google API Key as an instance parameter. This key allows the editor to make authorized calls to the Google Maps API.

NOTE: We provide a Google Maps API Key for use in our hosted domains.

Create a custom location field editor

To customize the appearance of a location field, you must first build a custom app that supports the Location field type in the entry field.

configuring the location field type

If your custom location field editor makes use of the default location field editor, you have to provide the App Framework's Google API Key as an instance parameter to the default location field editor.

Important: We provide a Google Maps API Key for use in our hosted App Framework domains. Reach out to support to obtain this key as it is not provided as part of the App SDK. If your custom location field editor is not hosted by Contentful, you'll need to provide a valid Google API Key.
<LocationEditor
  isInitiallyDisabled={true}
  field={widgetApi.field}
  parameters={{ instance: { googleMapsKey: <GoogleAPIKey> } } }
/>
NOTE: It’s best practice to pass the Google API Key to your app as an instance parameter.

configuring app instance parameters

Use a custom app to define location field appearance

Once your custom app is installed, you can customize the appearance of your location field by selecting it under the "Appearance" section of the field configuration settings.

customize location field appearance

If you're following best practices regarding instance parameters, this is where the Google API Key can be set to the App Frameworks Google Maps API Key obtained from support.