Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
baseaction.php
1<?php
2
4
10abstract class BaseAction implements Action
11{
17 protected ?bool $default;
23 protected ?string $className;
29 protected ?string $title;
37 protected ?string $href;
45 protected ?string $onclick;
46
52 abstract protected function getText(): string;
53
57 public function getControl(array $rawFields): ?array
58 {
59 $result = [
60 'TEXT' => $this->getText(),
61 ];
62
63 $propertyMap = [
64 'default' => 'DEFAULT',
65 'className' => 'ICONCLASS',
66 'title' => 'TITLE',
67 'href' => 'HREF',
68 'onclick' => 'ONCLICK',
69 ];
70 foreach ($propertyMap as $propertyName => $actionName)
71 {
72 $propertyValue = $this->{$propertyName} ?? null;
73 if (isset($propertyValue))
74 {
75 $result[$actionName] = $propertyValue;
76 }
77 }
78
79 return $result;
80 }
81}