function SessionStreamWrapper::getLocalPath

Same name in other branches
  1. 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::getLocalPath()
  2. 4.0.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::getLocalPath()

Returns the local path.

In our case, the local path is the URI minus the wrapper type. So a URI like 'session://one/two/three.txt' becomes 'one/two/three.txt'.

Parameters

string $uri: Optional URI, supplied when doing a move or rename.

Return value

string The local path.

11 calls to SessionStreamWrapper::getLocalPath()
SessionStreamWrapper::dirname in stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php
Gets the name of the directory from a given path.
SessionStreamWrapper::dir_opendir in stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php
SessionStreamWrapper::getExternalUrl in stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php
Overrides getExternalUrl().
SessionStreamWrapper::mkdir in stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php
Support for mkdir().
SessionStreamWrapper::realpath in stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php
Returns canonical, absolute path of the resource.

... See full list

File

stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php, line 240

Class

SessionStreamWrapper
Example stream wrapper class to handle session:// streams.

Namespace

Drupal\stream_wrapper_example\StreamWrapper

Code

protected function getLocalPath($uri = NULL) {
    if (!isset($uri)) {
        $uri = $this->uri;
    }
    $path = str_replace('session://', '', $uri);
    $path = trim($path, '/');
    return $path;
}