1<?php
2
3
4namespace ComboStrap;
5
6
7use ComboStrap\Meta\Api\MetadataText;
8use ComboStrap\Meta\Field\PageH1;
9use ComboStrap\Meta\Store\MetadataDokuWikiStore;
10
11class Lead extends MetadataText
12{
13
14    public const PROPERTY_NAME = 'lead';
15
16
17    public static function createForMarkup($page): Label
18    {
19        return (new Label())
20            ->setResource($page);
21    }
22
23    static public function getTab(): string
24    {
25        return MetaManagerForm::TAB_PAGE_VALUE;
26    }
27
28    static public function getDescription(): string
29    {
30        return "The lead is a tagline for a page";
31    }
32
33    static public function getLabel(): string
34    {
35        return "Lead";
36    }
37
38    static public function getName(): string
39    {
40        return self::PROPERTY_NAME;
41    }
42
43    static public function getPersistenceType(): string
44    {
45        return MetadataDokuWikiStore::PERSISTENT_DOKUWIKI_KEY;
46    }
47
48    static public function isMutable(): bool
49    {
50        return true;
51    }
52
53    static public function getCanonical(): string
54    {
55        return self::getName();
56    }
57
58    public function getDefaultValue()
59    {
60        if ($this->getResource()->isRootHomePage()) {
61            return Site::getTagLine();
62        }
63        throw new ExceptionNotFound();
64    }
65
66
67    static public function isOnForm(): bool
68    {
69        return true;
70    }
71}
72