Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Nov 27, 2024
1 parent b6c73ce commit 611d7ec
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Fields/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Statamic\Facades\Compare;
use Statamic\Support\Str;
use Statamic\View\Antlers\Language\Parser\DocumentTransformer;
use Traversable;

class Value implements ArrayAccess, IteratorAggregate, JsonSerializable
{
Expand Down Expand Up @@ -96,10 +97,6 @@ private function iteratorValue()
$value = $value->get();
}

if ($value instanceof Collection) {
$value = $value->all();
}

return $value;
}

Expand Down Expand Up @@ -127,7 +124,9 @@ public function jsonSerialize($options = 0)
#[\ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->iteratorValue());
$value = $this->iteratorValue();

return $value instanceof Traversable ? $value : new ArrayIterator($value);
}

public function shouldParseAntlers()
Expand Down

0 comments on commit 611d7ec

Please sign in to comment.