diff --git a/src/Fieldtypes/Review.php b/src/Fieldtypes/Review.php index e970b31..674159b 100644 --- a/src/Fieldtypes/Review.php +++ b/src/Fieldtypes/Review.php @@ -22,12 +22,18 @@ public function preload() return []; } - // when it's a new entry the "parent" is the collection + // when it's a new entry the "parent" might be a collection // in this case, we can't show it anyway so return empty if ($entry instanceof Collection) { return []; } + // if there's a computed field in the entry's collection that uses augmentation, + // this maybe be an empty entry, without an id + if (is_null($entry->id())) { + return []; + } + return ['site_url' => URL::reviewUrl($entry)]; } }