You are here

public function TrumbaBlockBase::convertInputToUriString in Trumba 2.x

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

Convert a full url or internal path string to a system Uri.

Parameters

$input:

Return value

string

1 call to TrumbaBlockBase::convertInputToUriString()
TrumbaBlockBase::blockSubmit in src/Plugin/Block/TrumbaBlockBase.php

File

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

Class

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

Namespace

Drupal\trumba\Plugin\Block

Code

public function convertInputToUriString($input) {
  $uri = '';
  if ($input) {
    if ($this
      ->isExternalUri($input)) {
      $uri = Url::fromUri($input)
        ->toUriString();
    }
    else {
      $uri = Url::fromUserInput($input)
        ->toUriString();
    }
  }
  return $uri;
}