Skip to content

Commit

Permalink
[5.0] Filter values of custom field, fix #42259 (#42285)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Quy <[email protected]>
  • Loading branch information
Fedik and Quy authored Nov 7, 2023
1 parent d2f6dd7 commit 5acec35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ function ($f) {
]))->getArgument('result', []);

if (\is_array($value)) {
$value = implode(' ', $value);
$value = array_filter($value, function ($v) {
return $v !== '' && $v !== null;
});
$value = $value ? implode(' ', $value) : '';
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function prepareField(PrepareFieldEvent $event)
{
$result = $this->onCustomFieldsPrepareField($event->getContext(), $event->getItem(), $event->getField());

if ($result) {
if ($result !== '' && $result !== null) {
$event->addResult($result);
}
}
Expand Down

0 comments on commit 5acec35

Please sign in to comment.