Hi, yes, the language is missing:
See:
Code: Select all
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '' && $this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
//$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\',{language: \''.PhocaMapsHelper::filterValue($language, 'text').'\'}),';
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
} else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
Now it should work, the only one addition to your code is to check the "mapbox" service, so other services are not negatively influneced (it is not possible to set mapbox routing generally for all other services):
- Your code:
Code: Select all
else if ($this->routerserviceurl != "'' && $this->maprouterapikey != ''"){
- The new code:
Code: Select all
else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '' && $this->routerserviceurl != '') {
So maybe I don't understand it correctly but are you displaying the map with another method than using the routing?
Map not rendered by Mapbox, but Routing yes?
Because then in such way it cannot be used generally becasue this will render mapbox routing for users who don't use mapbox ( if ($this->routerserviceurl != "'' && $this->maprouterapikey != ''") - no check for maptype)