class AssetsStream
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/StreamWrapper/AssetsStream.php \Drupal\Core\StreamWrapper\AssetsStream
Defines a Drupal stream wrapper class for optimized assets (assets://).
Provides support for storing publicly accessible optimized assets files with the Drupal file interface.
Hierarchy
- class \Drupal\Core\StreamWrapper\LocalStream implements \Drupal\Core\StreamWrapper\StreamWrapperInterface
- class \Drupal\Core\StreamWrapper\PublicStream extends \Drupal\Core\StreamWrapper\LocalStream
- class \Drupal\Core\StreamWrapper\AssetsStream uses \Drupal\Core\StringTranslation\StringTranslationTrait extends \Drupal\Core\StreamWrapper\PublicStream
- class \Drupal\Core\StreamWrapper\PublicStream extends \Drupal\Core\StreamWrapper\LocalStream
Expanded class hierarchy of AssetsStream
1 file declares its use of AssetsStream
- FileSystemForm.php in core/
modules/ system/ src/ Form/ FileSystemForm.php
1 string reference to 'AssetsStream'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses AssetsStream
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ AssetsStream.php, line 14
Namespace
Drupal\Core\StreamWrapperView source
class AssetsStream extends PublicStream {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public static function getType() : int {
return StreamWrapperInterface::LOCAL_HIDDEN;
}
/**
* {@inheritdoc}
*/
public function getName() : string {
return $this->t('Optimized assets files');
}
/**
* {@inheritdoc}
*/
public function getDescription() : string {
return $this->t('Public local optimized assets files served by the webserver.');
}
/**
* {@inheritdoc}
*/
public static function basePath($site_path = NULL) : string {
return Settings::get('file_assets_path', parent::basePath($site_path));
}
/**
* {@inheritdoc}
*/
public static function baseUrl() : string {
$public_path = Settings::get('file_public_path', 'sites/default/files');
$path = Settings::get('file_assets_path', $public_path);
if ($path === $public_path) {
$base_url = PublicStream::baseUrl();
}
else {
$base_url = $GLOBALS['base_url'] . '/' . $path;
}
return $base_url;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.