Skip to content

Commit b93f079

Browse files
authored
Update TAjaxSelect.php
1 parent 8412e84 commit b93f079

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Form/TAjaxSelect.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ private function getData(string $query = '', $default = null): array
129129

130130
private function initiateItems($value = null): void
131131
{
132-
if ($value === null && \count($this->items) > 0) {
133-
return;
134-
}
132+
$value = $value ?? $this->value;
133+
134+
if (\in_array($value, [null, '', []], true)) {
135+
if (\count($this->items) > 0) {
136+
return;
137+
}
135138

136-
if (!\in_array($value ?? $this->value, [null, '', []], true)) {
137-
$this->items = $this->getData('', $value ?? $this->value);
138-
} else {
139139
$this->items = $this->getData();
140+
} else {
141+
$this->items = $this->getData('', $value);
140142
}
141143
}
142144

0 commit comments

Comments
 (0)