ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
trait.ilDclFileFieldHelper.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
24trait ilDclFileFieldHelper
25{
26 private function valueToRID(?string $value): ?ResourceIdentification
27 {
28 if ($value !== null && ($rid = $this->irss->manage()->find($value)) !== null) {
29 return $rid;
30 }
31 return null;
32 }
33
34 private function valueToFileTitle(?string $value): string
35 {
36 return $this->valueToCurrentRevision($value)?->getTitle() ?? '';
37 }
38
39 private function valueToCurrentRevision(?string $value): ?Revision
40 {
41 $rid = $this->valueToRID($value);
42 if ($rid !== null) {
43 return $this->irss->manage()->getCurrentRevision($rid);
44 }
45
46 return null;
47 }
48}