Skip to content

fchaussin/grav-plugin-leaflet

 
 

Repository files navigation

Grav Leaflet Plugin

Leaflet is a Grav plugin and add the Leaflet in Grav pages.

Installation

Installing the plugin can be done in one of two ways. Our GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.

GPM Installation (Preferred)

The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's Terminal (also called the command line). From the root of your Grav install type:

bin/gpm install leaflet

This will install this plugin into your /user/plugins directory within Grav. Its files can be found under /your/site/grav/user/plugins/leaflet.

Manual Installation

To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins. Then, rename the folder to leaflet. You can find these files either on GetGrav.org.

You should now have all the plugin files under

/your/site/grav/user/plugins/leaflet

NOTE: This plugin is a modular component for Grav which requires Grav, the Error and Problems plugins, and a theme to be installed in order to operate.

Usage

Add the Twig code to your template or page (for page you need to enable the twig process in the configuration file):

{{ leaflet({params}) }}

The params format follow the Twig array, example:

{{ leaflet({'id': 'leaflet', 'class': 'leaflet'}) }}

The plugin comes with some sensible default configuration, that are pretty self explanatory:

Options

Variable Description Default Example
enabled Enable/Disable Plugin enable enabled: true
id Div ID (unique) leaflet id: "leaflet"
width Map Width 600 width: 100
w_unit Map Width unit px w_unit: "%"
height Map Height 450 height: 450
h_unit Map Height unit px h_unit: "px"
class Div Class leaflet class: "leaflet"
lat Latitude 51 latitude: "London"
lng Longitude 0 longitude: "London"
lat_marker Latitude Marker 51 latitude: "London"
lng_marker Longitude Marker 0 longitude: "London"
address Map Address address: "Rome street"
zoom Map Zoom 15 zoom: 15
css_tile_filter tiles css filter grayscale css_tile_filter: "grayscale"
css_tile_filter_value tiles css filter val .7 css_tile_filter_value: .7

To customize the plugin, you first need to create an override config. To do so, create the folder user/config/plugins (if it doesn't exist already) and copy the leaflet.yaml config file in there and then make your edits.

Also you can override the default options per-page:

---
title: 'My "Page"'

leaflet:
  id: "xxxxx"
  zoom: 20
---

Updating

As development for this plugin continues, new versions may become available that add additional features and functionality, improve compatibility with newer Grav releases, and generally provide a better user experience. Updating this plugin is easy, and can be done through Grav's GPM system, as well as manually.

GPM Update (Preferred)

The simplest way to update this plugin is via the Grav Package Manager (GPM). You can do this with this by navigating to the root directory of your Grav install using your system's Terminal (also called command line) and typing the following:

bin/gpm update leaflet

This command will check your Grav install to see if your plugin is due for an update. If a newer release is found, you will be asked whether or not you wish to update. To continue, type y and hit enter. The plugin will automatically update and clear Grav's cache.

Manual Update

Manually updating this plugin is pretty simple. Here is what you will need to do to get this done:

  • Delete the your/site/user/plugins/leaflet directory.
  • Download the new version of this plugin from either. GetGrav.org.
  • Unzip the zip file in your/site/user/plugins and rename the resulting folder to leaflet.
  • Clear the Grav cache. The simplest way to do this is by going to the root Grav directory in terminal and typing bin/grav clear-cache.

NOTE: Any changes you have made to any of the files listed under this directory will also be removed and replaced by the new set. Any files located elsewhere (for example a YAML settings file placed in user/config/plugins) will remain intact.

About

Grav Leaflet Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 73.7%
  • HTML 26.3%