From e43f07993aab20b54ba475163bbc3d13dcb80c97 Mon Sep 17 00:00:00 2001 From: Sunny Side Up Date: Sun, 3 Mar 2024 20:33:04 +1300 Subject: [PATCH 1/2] API: allow Silverstripe 5.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a1a1445..974d380 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,6 @@ } }, "require": { - "silverstripe/framework": "~4.0" + "silverstripe/framework": "^4.0 || ^5.0" } } From be44f30882ef4a3153e1e06b083ce36b7d588360 Mon Sep 17 00:00:00 2001 From: SDGM Date: Mon, 8 Apr 2024 19:39:53 +1200 Subject: [PATCH 2/2] SS5 small fixes --- src/forms/HasOneAutocompleteField.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/forms/HasOneAutocompleteField.php b/src/forms/HasOneAutocompleteField.php index 18b94b6..55cfe8d 100644 --- a/src/forms/HasOneAutocompleteField.php +++ b/src/forms/HasOneAutocompleteField.php @@ -64,6 +64,8 @@ class HasOneAutocompleteField extends FormField protected $clearButtonEnabled = false; + protected $sourceObject; + /** * Variable that sets the autocomplete delay * @@ -118,7 +120,7 @@ public function search(HTTPRequest $request) $json = $this->processResults($results); } - return Convert::array2json($json); + return json_encode($json); } /** @@ -128,7 +130,7 @@ public function search(HTTPRequest $request) */ protected function getResults($query) { - $searchFields = ($this->getSearchFields() ?: singleton($this->sourceObject)->stat('searchable_fields')); + $searchFields = ($this->getSearchFields() ?: singleton($this->sourceObject)->config()->get('searchable_fields')); if(!$searchFields) { throw new Exception(