LeafLet Awesome Plugin
What is LeafLet Awesome Plugin?
In order to make it work with GlyphIcon (included with Bootstrap) or Font Awesome files you need to add the required files your self. So, make sure the files are included prior using this plugin.
To swap between GlyphIcon (default) and FontAwesome, you just need to modify its prefix. Should work with other Font Toolkits as long as it follows the following class signature: "prefix prefix-iconname".
The preferred way to install this extension is through composer.
composer require 2amigos/yii2-leaflet-awesome-plugin:~1.0
or add the following to the require section of your application's
"2amigos/yii2-leaflet-awesome-plugin" : "~1.0"
use dosamigos\leaflet\plugins\awesome\AwesomeMarker; use dosamigos\leaflet\types\LatLng; use dosamigos\leaflet\layers\Marker; // LeafLet initialization component // [...] // Initialize plugin $awesomeMarkers = new AwesomeMarker(['name' => 'awesome']); // install $leafLet->installPlugin($awesomeMarkers); // sample location $center = new LatLng(['lat' => 51.508, 'lng' => -0.11]); // generate icon through its icon $marker = new Marker([ 'latLng' => $center, 'icon' => $leafLet->plugins->awesome->make("star",['markerColor' => "green", 'prefix' => "fa"]), 'popupContent' => 'Hey! I am a marker' ]);