5 use Drupal\Core\TypedData\TypedData;
8 * Computed file URL property class.
10 class ComputedFileUrl extends TypedData {
13 * Computed root-relative file URL.
17 protected $url = NULL;
22 public function getValue() {
23 if ($this->url !== NULL) {
27 assert($this->getParent()->getEntity() instanceof FileInterface);
29 $uri = $this->getParent()->getEntity()->getFileUri();
30 $this->url = file_url_transform_relative(file_create_url($uri));
38 public function setValue($value, $notify = TRUE) {
41 // Notify the parent of any changes.
42 if ($notify && isset($this->parent)) {
43 $this->parent->onChange($this->name);