function ExtensionStreamBase::getTarget
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|false 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
2 calls to ExtensionStreamBase::getTarget()
- ExtensionStreamBase::dirname in core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php - Gets the name of the directory from a given path.
- ExtensionStreamBase::getExternalUrl in core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php - Returns a web accessible URL for the resource.
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ ExtensionStreamBase.php, line 67
Class
- ExtensionStreamBase
- Defines a base stream wrapper implementation for extension assets.
Namespace
Drupal\Core\StreamWrapperCode
protected function getTarget($uri = NULL) : string {
if ($target = strstr(parent::getTarget($uri), '/')) {
$this->checkFileExtension($uri ?? $this->uri);
return trim($target, '/');
}
return '';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.