You are here

public function TrumbaBlockBase::convertUriToRelativePathOrUrl in Trumba 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Block/TrumbaBlockBase.php \Drupal\trumba\Plugin\Block\TrumbaBlockBase::convertUriToRelativePathOrUrl()

Convert a saved Uri String to an relative path for internal uri's or a full Url for external urls

Parameters

$uri:

Return value

\Drupal\Core\GeneratedUrl|string

1 call to TrumbaBlockBase::convertUriToRelativePathOrUrl()
TrumbaBlockBase::blockForm in src/Plugin/Block/TrumbaBlockBase.php

File

src/Plugin/Block/TrumbaBlockBase.php, line 153

Class

TrumbaBlockBase
Defines a base block implementation that Trumba blocks plugins will extend.

Namespace

Drupal\trumba\Plugin\Block

Code

public function convertUriToRelativePathOrUrl($uri) {
  return $uri ? Url::fromUri($uri)
    ->toString() : '';
}