You are here

public function LeafletService::pathToAbsolute in Leaflet 8

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

1 call to LeafletService::pathToAbsolute()
LeafletService::preProcessMapSettings in src/LeafletService.php
Pre Process the MapSettings.

File

src/LeafletService.php, line 347

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;
}