protected function Resource::__construct in D7 Media 6
drupal_file constructor.
Parameters
object $file (optional) stdClass object to initialize self with.:
File
- resource/
resource.module, line 140 - Resource API for Drupal, a replacement for files.
Class
- Resource
- Base Resource class.
Code
protected function __construct($resource) {
$this->streamManager = ResourceStreamWrapperManager::singleton();
$class = $this->streamManager
->class(parse_url($url, PHP_URL_SCHEME));
$this->streamWrapper = new $class();
$this->rid = isset($resource->rid) ? $resource->rid : 0;
$this->url = $resource->url;
$this->mime = $resoruce->mime;
$this->size = $resource->size;
$this->name = $resource->name;
$this->htmlUrl = $this->streamWrapper
->htmlUrl($this->url);
}