1<?php
2
3
4namespace ComboStrap\Meta\Field;
5
6
7use ComboStrap\DataType;
8use ComboStrap\Meta\Api\MetadataText;
9
10class AliasType extends MetadataText
11{
12
13
14    public const PROPERTY_NAME = "alias-type";
15    public const PERSISTENT_NAME = "type";
16    const REDIRECT = "redirect";
17    const ALIAS_TYPE_VALUES = [AliasType::SYNONYM, AliasType::REDIRECT];
18    const SYNONYM = "synonym";
19    const DEFAULT = self::REDIRECT;
20
21    public static function createForParent(Aliases $parent): AliasType
22    {
23        return new AliasType($parent);
24    }
25
26    static     public function getDescription(): string
27    {
28        return "The type of the alias";
29    }
30
31    static public function getLabel(): string
32    {
33        return "Alias Type";
34    }
35
36    public static function getName(): string
37    {
38        return self::PROPERTY_NAME;
39    }
40
41    public static function getPersistentName(): string
42    {
43        return self::PERSISTENT_NAME;
44    }
45
46
47    static public function getPersistenceType(): string
48    {
49        return DataType::TEXT_TYPE_VALUE;
50    }
51
52    static public function isMutable(): bool
53    {
54        return true;
55    }
56
57    public function getPossibleValues(): ?array
58    {
59        return AliasType::ALIAS_TYPE_VALUES;
60    }
61
62
63    public function getDefaultValue(): string
64    {
65        return AliasType::DEFAULT;
66    }
67
68
69}
70