Skip to content

Commit b788157

Browse files
author
desaintflorent
committed
fix: cast string config values to enum types for searchProvider and searchBoxType
1 parent 39472f3 commit b788157

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Traits/WithMapProps.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,18 @@ public function __construct($name, $attribute = null, callable $resolveCallback
8484
$this->showDetailButton = $config['show-detail-button'];
8585

8686
$this->showSearchBox = $searchConfig['enable'];
87-
$this->searchProvider = $searchConfig['provider'];
87+
$this->searchProvider = $searchConfig['provider'] instanceof MapSearchProvider
88+
? $searchConfig['provider']
89+
: MapSearchProvider::from($searchConfig['provider']);
8890
$this->searchProviderApiKey = $searchConfig['api-key'];
8991
$this->searchAutocomplete = $searchConfig['autocomplete'];
9092
$this->searchAutocompleteMinLength = $searchConfig['autocomplete-min-length'];
9193
$this->searchAutocompleteTimeout = $searchConfig['autocomplete-timeout'];
9294
$this->searchLanguage = $searchConfig['language'];
9395
$this->searchPlaceholder = __($searchConfig['placeholder']);
94-
$this->searchBoxType = $searchConfig['box-type'];
96+
$this->searchBoxType = $searchConfig['box-type'] instanceof MapSearchBoxType
97+
? $searchConfig['box-type']
98+
: MapSearchBoxType::from($searchConfig['box-type']);
9599
$this->searchResultLimit = $searchConfig['limit'];
96100
$this->searchResultKeepOpen = $searchConfig['keep-open'];
97101

0 commit comments

Comments
 (0)