You are here

public function LeafletService::pathToAbsolute in Leaflet 2.0.x

Same name and namespace in other branches
  1. 8 src/LeafletService.php \Drupal\leaflet\LeafletService::pathToAbsolute()
  2. 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\leaflet

Code

public function pathToAbsolute($path) {
  if (!UrlHelper::isExternal($path)) {
    $path = Url::fromUri('base:', [
      'absolute' => TRUE,
    ])
      ->toString() . $path;
  }
  return $path;
}