class TemporaryStream in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/StreamWrapper/TemporaryStream.php \Drupal\Core\StreamWrapper\TemporaryStream
- 9 core/lib/Drupal/Core/StreamWrapper/TemporaryStream.php \Drupal\Core\StreamWrapper\TemporaryStream
Defines a Drupal temporary (temporary://) stream wrapper class.
Provides support for storing temporarily accessible files with the Drupal file interface.
Hierarchy
- class \Drupal\Core\StreamWrapper\LocalStream implements StreamWrapperInterface
- class \Drupal\Core\StreamWrapper\TemporaryStream
Expanded class hierarchy of TemporaryStream
1 string reference to 'TemporaryStream'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses TemporaryStream
File
- core/
lib/ Drupal/ Core/ StreamWrapper/ TemporaryStream.php, line 13
Namespace
Drupal\Core\StreamWrapperView source
class TemporaryStream extends LocalStream {
/**
* {@inheritdoc}
*/
public static function getType() {
return StreamWrapperInterface::LOCAL_HIDDEN;
}
/**
* {@inheritdoc}
*/
public function getName() {
return t('Temporary files');
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return t('Temporary local files for upload and previews.');
}
/**
* {@inheritdoc}
*/
public function getDirectoryPath() {
return \Drupal::service('file_system')
->getTempDirectory();
}
/**
* {@inheritdoc}
*/
public function getExternalUrl() {
$path = str_replace('\\', '/', $this
->getTarget());
return Url::fromRoute('system.temporary', [], [
'absolute' => TRUE,
'query' => [
'file' => $path,
],
])
->toString();
}
}