You are here

protected function PrintableStream::getTarget in Printer and PDF versions for Drupal 8+ 2.x

Returns the local writable target of the resource within the stream.

This function should be used in place of calls to realpath() or similar functions when attempting to determine the location of a file. While functions like realpath() may return the location of a read-only file, this method may return a URI or path suitable for writing that is completely separate from the URI used for reading.

Parameters

string $uri: Optional URI.

Return value

string|bool Returns a string representing a location suitable for writing of a file, or FALSE if unable to write to the file such as with read-only streams.

Overrides LocalStream::getTarget

1 call to PrintableStream::getTarget()
PrintableStream::getExternalUrl in src/StreamWrapper/PrintableStream.php
@inheritDoc

File

src/StreamWrapper/PrintableStream.php, line 65

Class

PrintableStream
Defines a Drupal stream wrapper base class for files to be embedded in the PDF.

Namespace

Drupal\Printable\StreamWrapper

Code

protected function getTarget($uri = NULL) {
  if (!isset($uri)) {
    $uri = $this->uri;
  }
  [
    ,
    $target,
  ] = explode('://', $uri, 2);
  return $target;
}