11 private bool $multiple;
12 private string $listMode;
14 private string $compiledType;
18 public function __construct(
string $name, array $property, array $items)
20 $this->multiple = ($property[
'MULTIPLE'] ??
'N') ===
'Y';
25 parent::__construct($name, $this->getCompiledType());
27 $this->items = $items;
30 private function compileType(): void
32 if (!isset($this->compiledType))
34 $this->compiledType = match ($this->listMode)
37 ? Grid\Editor\Types::MULTISELECT
38 : Grid\Editor\Types::DROPDOWN
40 default => Grid\Editor\Types::CUSTOM,
45 private function getCompiledType(): string
47 return $this->compiledType;
50 private function isSelectMode(): bool
52 $compiledType = $this->getCompiledType();
55 $compiledType === Grid\Editor\Types::MULTISELECT
56 || $compiledType === Grid\Editor\Types::DROPDOWN
65 $result = parent::toArray();
67 if ($this->isSelectMode())
70 'ITEMS' => $this->getItemsAsDropdown(),
82 private function getItemsAsDropdown(): array
94 foreach ($this->items as $value)
97 'VALUE' => $value[
'ID'],
98 'NAME' => $value[
'VALUE'],
static getMessage($code, $replace=null, $language=null)