253

Product support

Get help in the plugin support forum.

Categories

LeafletPro is an OctoberCMS plugin for easily embedding maps using OpenStreetMap and Leaflet.

OpenStreetMap is a collaborative project to create a free editable map of the world while Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps.

Installation

You can install the plugin using any of the following methods:

  1. Install using OctoberCMS marketplace
  2. Install using composer: composer require initbiz/oc-leafletpro-plugin
  3. Clone the GitHub repo to plugins/initbiz/leafletpro directory of your project and run composer install in your project's directory

The plugin will automatically install maxhelias/php-nominatim, which is used to query Nominatim service. If you are going to use the Nominatim service, recall the Nominatim usage policy.

Embed the map

You can embed a map using the Leaflet map component.

Leaflet map component

As you see in the above screenshot you can specify a few parameters:

  • Longitude and latitude of the center of the map that is shown
  • Initial zoom of the map
  • Scroll protection to start zooming with scroll only after clicking the map
  • Leaflet plugins - checkboxes for enabling Leaflet plugins for the component

Customize popup content

Custom marker popup with InIT.biz logo

The popup content is defined individually for every marker. By default, it's seeded with the content of plugins/initbiz/leafletpro/models/marker/_default_popup_content.htm.

The partial can be easily overridden by creating the _default_popup_content.htm file in your theme in the partials directory. Remember that overriding the partial will not change current marker popups. This partial is used only as a seeder when popup content is empty while saving marker.

Cumulus integration

The plugin is nicely integrated with the Initbiz.CumulusCore plugin.

  1. When the cluster is created or updated (address changed), a marker is created or updated
  2. When the cluster is selected in create marker view address is refreshed from cluster's address

TODO / Future plans

  • Marker categories to filter markers on maps
  • Single marker map
  • Backend form widget for current lon / lat preview and for setting lon / lat using the map marker
  • Easily configurable marker icons for markers and categories from the backend
  • Add possibility to manage more than one marker by Cumulus clusters
  • Pop up in backend with other possibilities for the same address (right now getting only the first element)
  • Support Leaflet plugins
1.1.1

Fix issue in checkbox properties

Nov 08, 2019

1.1.0

Added single map component and a few major changes

Jun 04, 2019

1.0.3

Custom default marker icon URL in settings and overriding initial lon, lat and zoom using GET params

May 16, 2019

1.0.2

Added markers table

Mar 08, 2019

1.0.1

Initial version of LeafletPro

Mar 08, 2019