Hi!
Im relatively new to the Yii framework. I’m trying to get leaflet extension to work on my project. I installed it via composer and everything seems to be installed properly but when I try to insert it into an activeForm it throws me this error:
The file or directory to be published does not exist: /Users/StationDomain/Pega/Repos/Expositown/web_expositown/vendor/bower/leaflet/dist
Im trying to build a Geosearch field with a map.
The extensions I have installed are:
"2amigos/yii2-leaflet-extension": "~1.0",
"2amigos/yii2-leaflet-geocoder-plugin": "~1.0",
"2amigos/yii2-leaflet-geosearch-plugin": "~1.0"
This is my code on the ActiveForm (its just the same as the provided on GitHub):
<?php
$center = new LatLng(['lat' => 39.67442740076734, 'lng' => 2.9347229003906246]);
$geoSearchPlugin = new GeoSearch([
'service' => GeoSearch::SERVICE_OPENSTREETMAP
]);
$tileLayer = new TileLayer([
'urlTemplate' => 'link not allowed because its one of my first posts...',
'clientOptions' => [
'attribution' => 'Tiles Courtesy of MapQuest ' . ', ' . 'Map data © OpenStreetMap contributors, ' . 'CC-BY-SA', 'subdomains' => '1234'
]
]);
$leafLet = new LeafLet([
'name' => 'geoMap',
'tileLayer' => $tileLayer,
'center' => $center,
'zoom' => 10,
'clientEvents' => [ // setting up one of the geo search events for fun
'geosearch_showlocation' => 'function(e){ console.log(e.target); }'
]
]);
// add the plugin
$leafLet->installPlugin($geoSearchPlugin);
// run the widget (you can also use Map::widget([...]))
echo $leafLet->widget();
?>