1<?php
2
3
4namespace ComboStrap;
5
6
7use DateTime;
8
9/**
10
11 * @package ComboStrap
12 * Represents the wiki id of a resource
13 */
14class DokuwikiId extends MetadataText
15{
16
17
18    public const DOKUWIKI_ID_ATTRIBUTE = "id";
19
20    public static function createForPage(ResourceCombo $page): DokuwikiId
21    {
22        return (new DokuwikiId())
23            ->setResource($page);
24    }
25
26    public function getDefaultValue(): ?DateTime
27    {
28        return null;
29    }
30
31    public function getValue(): ?string
32    {
33        return $this->getResource()->getPath()->getDokuwikiId();
34    }
35
36
37    public static function getName(): string
38    {
39        return self::DOKUWIKI_ID_ATTRIBUTE;
40    }
41
42
43    public function getPersistenceType(): string
44    {
45        return Metadata::DERIVED_METADATA;
46    }
47
48
49    public function getTab(): ?string
50    {
51        return null;
52    }
53
54    public function getDescription(): string
55    {
56        return "The id of a resource represents the path of a resource from its root directory";
57    }
58
59    public function getLabel(): string
60    {
61        return "Wiki Id";
62    }
63
64    public function getMutable(): bool
65    {
66        return false;
67    }
68}
69