class VendorStreamWrapperService in Vendor Stream Wrapper 8
Provides services for the Vendor Stream Wrapper module.
Hierarchy
- class \Drupal\vendor_stream_wrapper\Service\VendorStreamWrapperService implements VendorStreamWrapperServiceInterface
Expanded class hierarchy of VendorStreamWrapperService
1 string reference to 'VendorStreamWrapperService'
1 service uses VendorStreamWrapperService
File
- src/
Service/ VendorStreamWrapperService.php, line 10
Namespace
Drupal\vendor_stream_wrapper\ServiceView source
class VendorStreamWrapperService implements VendorStreamWrapperServiceInterface {
/**
* The Stream Wrapper Service.
*
* @var Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
*/
protected $streamWrapperService;
/**
* Constructor.
*/
public function __construct(StreamWrapperManagerInterface $streamWrapperManager) {
$this->streamWrapperService = $streamWrapperManager;
}
/**
* {@inheritdoc}
*/
public function creatUrlFromUri($uri) {
if (strpos($uri, 'vendor://') === 0) {
if ($wrapper = $this->streamWrapperService
->getViaUri($uri)) {
return $wrapper
->getExternalUrl()
->toString();
}
}
else {
return $uri;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
VendorStreamWrapperService:: |
protected | property | The Stream Wrapper Service. | |
VendorStreamWrapperService:: |
public | function |
Creates a public facing URL from URIs with the vendor:// schema. Overrides VendorStreamWrapperServiceInterface:: |
|
VendorStreamWrapperService:: |
public | function | Constructor. |