1 | <?php |
||
28 | class Link extends Field implements PreviewableFieldInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | public $selectionLabel = ' -- Select link type --'; |
||
34 | |||
35 | /** |
||
36 | * Type objects that have been configured via the admin |
||
37 | * |
||
38 | * @var TypeInterface[] |
||
39 | */ |
||
40 | protected $types = []; |
||
41 | |||
42 | /** |
||
43 | * Raw configurations that have been configured via the admin |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $typeConfigs = []; |
||
48 | |||
49 | /** |
||
50 | * @return TypeInterface[] |
||
51 | * @throws \yii\base\InvalidConfigException |
||
52 | */ |
||
53 | public function getTypes() |
||
60 | |||
61 | /** |
||
62 | * @param array $types |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function setTypes(array $types) |
||
73 | |||
74 | /** |
||
75 | * @param string $identifier |
||
76 | * @return TypeInterface|null |
||
77 | * @throws \yii\base\InvalidConfigException |
||
78 | */ |
||
79 | public function getType(string $identifier) |
||
93 | |||
94 | /** |
||
95 | * @inheritdoc |
||
96 | */ |
||
97 | public static function displayName(): string |
||
101 | |||
102 | /** |
||
103 | * @inheritdoc |
||
104 | */ |
||
105 | public function getContentColumnType(): string |
||
109 | |||
110 | /** |
||
111 | * @inheritdoc |
||
112 | */ |
||
113 | public function getTableAttributeHtml($value, ElementInterface $element): string |
||
121 | |||
122 | /** |
||
123 | * @inheritdoc |
||
124 | * @throws \Twig_Error_Loader |
||
125 | * @throws \yii\base\Exception |
||
126 | * @throws \yii\base\InvalidConfigException |
||
127 | */ |
||
128 | public function getSettingsHtml() |
||
144 | |||
145 | /** |
||
146 | * @inheritdoc |
||
147 | * @throws \Twig_Error_Loader |
||
148 | * @throws \yii\base\Exception |
||
149 | */ |
||
150 | public function getInputHtml($value, ElementInterface $element = null): string |
||
161 | |||
162 | /** |
||
163 | * @inheritdoc |
||
164 | */ |
||
165 | public function serializeValue($value, ElementInterface $element = null) |
||
182 | |||
183 | /** |
||
184 | * @inheritdoc |
||
185 | * @throws \yii\base\InvalidConfigException |
||
186 | */ |
||
187 | public function getSettings(): array |
||
201 | |||
202 | /** |
||
203 | * @inheritdoc |
||
204 | */ |
||
205 | public function getElementValidationRules(): array |
||
213 | |||
214 | /** |
||
215 | * @param $value |
||
216 | * @param ElementInterface|null $element |
||
217 | * @return array|TypeInterface|mixed|object|null |
||
218 | * @throws \yii\base\InvalidConfigException |
||
219 | */ |
||
220 | public function normalizeValue($value, ElementInterface $element = null) |
||
260 | |||
261 | /** |
||
262 | * Create objects from all (remaining) configurations |
||
263 | * |
||
264 | * @throws \yii\base\InvalidConfigException |
||
265 | */ |
||
266 | private function resolveConfigs() |
||
273 | |||
274 | /** |
||
275 | * @param string $identifier |
||
276 | * @param array $config |
||
277 | * @return TypeInterface|null |
||
278 | * @throws \yii\base\InvalidConfigException |
||
279 | */ |
||
280 | private function resolveConfig(string $identifier, array $config) |
||
297 | |||
298 | /** |
||
299 | * @param $type |
||
300 | * @return array|object|null |
||
301 | * @throws \yii\base\InvalidConfigException |
||
302 | */ |
||
303 | private function createType($type) |
||
323 | |||
324 | /** |
||
325 | * @param string $identifier |
||
326 | * @return TypeInterface|null |
||
327 | * @throws \yii\base\InvalidConfigException |
||
328 | */ |
||
329 | private function createFromConfig(string $identifier) |
||
337 | } |
||
338 |