ModuleStream.php in System stream wrapper 8
File
src/StreamWrapper/ModuleStream.php
View source
<?php
namespace Drupal\system_stream_wrapper\StreamWrapper;
class ModuleStream extends ExtensionStreamBase {
protected $moduleHandler;
protected function getOwnerName() {
$name = parent::getOwnerName();
if (!$this
->getModuleHandler()
->moduleExists($name)) {
throw new \InvalidArgumentException("Module {$name} does not exist or is not installed");
}
return $name;
}
protected function getDirectoryPath() {
return $this
->getModuleHandler()
->getModule($this
->getOwnerName())
->getPath();
}
public function getName() {
return $this
->t('Module files');
}
public function getDescription() {
return $this
->t('Local files stored under module directory.');
}
protected function getModuleHandler() {
if (!isset($this->moduleHandler)) {
$this->moduleHandler = \Drupal::moduleHandler();
}
return $this->moduleHandler;
}
}
Classes
Name |
Description |
ModuleStream |
Defines the read-only module:// stream wrapper for module files. |