Skip to content

Commit

Permalink
Merge pull request #97 from lukereative/patch-1
Browse files Browse the repository at this point in the history
Allow for arrays as a search value
  • Loading branch information
blueo authored May 20, 2024
2 parents 9faa891 + 34643dc commit 3aaafc5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Extensions/DBFieldExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@
class DBFieldExtension extends Extension
{

public function getSearchValue(): string
public function getSearchValue(): array|string
{
$value = $this->owner->getValue() ?? '';

if (is_array($value)) {
array_map(
function ($arrayItem) {
return preg_replace('/\s+/S', ' ', strip_tags($arrayItem));
},
$value
);

return $value;
}

return preg_replace('/\s+/S', ' ', strip_tags($value));
}

Expand Down

0 comments on commit 3aaafc5

Please sign in to comment.