public function LeafletService::pathToAbsolute in Leaflet 2.0.x
Same name and namespace in other branches
- 8 src/LeafletService.php \Drupal\leaflet\LeafletService::pathToAbsolute()
- 2.1.x src/LeafletService.php \Drupal\leaflet\LeafletService::pathToAbsolute()
Generate an Absolute Url from a string Path.
Parameters
string $path: The path string to generate.
Return value
string The absolute $path
File
- src/
LeafletService.php, line 329
Class
- LeafletService
- Provides a LeafletService class.
Namespace
Drupal\leafletCode
public function pathToAbsolute($path) {
if (!UrlHelper::isExternal($path)) {
$path = Url::fromUri('base:', [
'absolute' => TRUE,
])
->toString() . $path;
}
return $path;
}