You are here

protected function InsertFileWidgetUtility::aggregateUrl in Insert 8

Parameters

string $uri:

boolean $absolute:

boolean [$clean_urls]:

Return value

string

1 call to InsertFileWidgetUtility::aggregateUrl()
InsertFileWidgetUtility::aggregateVariables in src/Utility/InsertFileWidgetUtility.php
1 method overrides InsertFileWidgetUtility::aggregateUrl()
InsertImageWidgetUtility::aggregateUrl in src/Utility/InsertImageWidgetUtility.php
@inheritdoc This method is modeled after \Drupal\image\Entity\ImageStyle::buildUrl, but with the modification that it will consistently use absolute or relative URLs, depending on the Insert setting.

File

src/Utility/InsertFileWidgetUtility.php, line 441

Class

InsertFileWidgetUtility

Namespace

Drupal\insert\Utility

Code

protected function aggregateUrl($uri, $absolute) {
  $url = file_create_url($uri);
  if (!$absolute && strpos($url, $GLOBALS['base_url']) === 0) {
    $url = base_path() . ltrim(str_replace($GLOBALS['base_url'], '', $url), '/');
  }
  return $url;
}