diff --git a/src/CoreExtensions/ObjectData/IndexFieldSelection.php b/src/CoreExtensions/ObjectData/IndexFieldSelection.php index 0aa8e7e7e..ba9157f98 100644 --- a/src/CoreExtensions/ObjectData/IndexFieldSelection.php +++ b/src/CoreExtensions/ObjectData/IndexFieldSelection.php @@ -23,14 +23,14 @@ class IndexFieldSelection public string $field; /** - * @var string|string[]|null + * @var string|string[]|int|null */ - public string|array|null $preSelect; + public string|array|int|null $preSelect; /** - * @param string|string[] $preSelect + * @param string|string[]|int $preSelect */ - public function __construct(?string $tenant, string $field, array|string|null $preSelect) + public function __construct(?string $tenant, string $field, array|string|int|null $preSelect) { $this->field = $field; $this->preSelect = $preSelect; @@ -50,7 +50,7 @@ public function getField(): string /** * @param string|string[] $preSelect */ - public function setPreSelect(array|string $preSelect): void + public function setPreSelect(array|string|int $preSelect): void { $this->preSelect = $preSelect; } @@ -58,7 +58,7 @@ public function setPreSelect(array|string $preSelect): void /** * @return string|string[]|null */ - public function getPreSelect(): array|string|null + public function getPreSelect(): array|string|int|null { return $this->preSelect; } diff --git a/src/FilterService/FilterType/AbstractFilterType.php b/src/FilterService/FilterType/AbstractFilterType.php index 153a7a5b2..5c69ec86c 100644 --- a/src/FilterService/FilterType/AbstractFilterType.php +++ b/src/FilterService/FilterType/AbstractFilterType.php @@ -81,7 +81,7 @@ protected function getTemplate(AbstractFilterDefinitionType $filterDefinition): return $template; } - protected function getPreSelect(AbstractFilterDefinitionType $filterDefinition): array|string|null + protected function getPreSelect(AbstractFilterDefinitionType $filterDefinition): array|string|int|null { $field = $filterDefinition->getField(); if ($field instanceof IndexFieldSelection) { diff --git a/src/Resources/public/js/indexfieldselectionfield/tags/indexFieldSelection.js b/src/Resources/public/js/indexfieldselectionfield/tags/indexFieldSelection.js index bf9645805..f6fdde6cd 100644 --- a/src/Resources/public/js/indexfieldselectionfield/tags/indexFieldSelection.js +++ b/src/Resources/public/js/indexfieldselectionfield/tags/indexFieldSelection.js @@ -62,10 +62,10 @@ pimcore.object.tags.indexFieldSelection = Class.create(pimcore.object.tags.selec load: function(store) { if(this.data) { if(this.preSelectCombobox.rendered) { - this.preSelectCombobox.setValue(this.data.preSelect); + this.preSelectCombobox.setValue(this.data.preSelect.split(',').map(Number)); } else { this.preSelectCombobox.addListener("afterRender", function() { - this.preSelectCombobox.setValue(this.data.preSelect); + this.preSelectCombobox.setValue(this.data.preSelect.split(',').map(Number)); }.bind(this)); } } @@ -239,10 +239,10 @@ pimcore.object.tags.indexFieldSelection = Class.create(pimcore.object.tags.selec if(this.fieldConfig.multiPreSelect == 'local_single' || this.fieldConfig.multiPreSelect == 'local_multi') { if(this.preSelectCombobox.rendered) { - this.preSelectCombobox.setValue(this.data.preSelect); + this.preSelectCombobox.setValue(this.data.preSelect.split(',').map(Number)); } else { this.preSelectCombobox.addListener("afterRender", function() { - this.preSelectCombobox.setValue(this.data.preSelect); + this.preSelectCombobox.setValue(this.data.preSelect.split(',').map(Number)); }.bind(this)); } }