class ThemeStream

Defines the read-only theme:// stream wrapper for theme files.

Only enabled themes are supported.

Example Usage:

theme:
//my_theme/css/component.css

Points to the component.css file in the theme my_theme's css directory.

Hierarchy

Expanded class hierarchy of ThemeStream

1 file declares its use of ThemeStream
ExtensionStreamTest.php in core/tests/Drupal/KernelTests/Core/StreamWrapper/ExtensionStreamTest.php
1 string reference to 'ThemeStream'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses ThemeStream
stream_wrapper.theme in core/core.services.yml
Drupal\Core\StreamWrapper\ThemeStream

File

core/lib/Drupal/Core/StreamWrapper/ThemeStream.php, line 21

Namespace

Drupal\Core\StreamWrapper
View source
final class ThemeStream extends ExtensionStreamBase {
  
  /**
   * {@inheritdoc}
   */
  public function getName() : TranslatableMarkup {
    return new TranslatableMarkup('Theme files');
  }
  
  /**
   * {@inheritdoc}
   */
  public function getDescription() : TranslatableMarkup {
    return new TranslatableMarkup("Local files stored under a theme's directory.");
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getExtension(string $extension_name) : Extension {
    return \Drupal::service('theme_handler')->getTheme($extension_name);
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.