Skip to content

Commit

Permalink
Fix critical issue with search fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy Čupić committed Oct 2, 2024
1 parent ea44ba7 commit 0fb92e8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/FieldType/SearchFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public function __construct(
*/
public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array
{
if ($this->isEmpty($field)) {
return [];
}

$remoteResourceLocationId = $field->value->externalData['remote_resource_location_id'];
$remoteId = $field->value->externalData['remote_id'];
$watermarkText = $field->value->externalData['watermark_text'];
Expand Down Expand Up @@ -156,6 +160,11 @@ public function getDefaultSortField(): ?string
return $this->getDefaultMatchField();
}

private function isEmpty(Field $field): bool
{
return $field->value->externalData === null;
}

private function prepareStringValue(?string $value): ?string
{
return $value !== null ? trim(mb_substr($value, 0, 255)) : null;
Expand Down

0 comments on commit 0fb92e8

Please sign in to comment.