You are here

public function TrumbaBlockBase::convertUriToAbsolutePathOrUrl in Trumba 2.x

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

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

Parameters

$uri:

Return value

\Drupal\Core\GeneratedUrl|string

3 calls to TrumbaBlockBase::convertUriToAbsolutePathOrUrl()
TrumbaMainCalendarSpudBlock::build in src/Plugin/Block/TrumbaMainCalendarSpudBlock.php
Builds and returns the renderable array for this block plugin.
TrumbaOpenSpudBlock::build in src/Plugin/Block/TrumbaOpenSpudBlock.php
Builds and returns the renderable array for this block plugin.
TrumbaPromoControlSpudBlock::build in src/Plugin/Block/TrumbaPromoControlSpudBlock.php
Builds and returns the renderable array for this block plugin.

File

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

Class

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

Namespace

Drupal\trumba\Plugin\Block

Code

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