Skip to content

Commit

Permalink
Return empty string when there's no asset
Browse files Browse the repository at this point in the history
  • Loading branch information
BobWez98 authored Oct 2, 2024
1 parent 822dc0d commit fc551de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Responsive.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Statamic\Assets\Asset;
use Statamic\Fields\Value;
use Statamic\Statamic;

class Responsive
{
public static function handle(mixed ...$arguments): Factory|View|string
{
$image = $arguments[0];
$image = get_class($image) === 'Statamic\Fields\Value' ? $image->value() : $image;
$image = $image instanceof Value ? $image->value() : $image;
$arguments = $arguments[1] ?? [];

if (! $image) {
if (! $image || !($image instanceof Asset)) {
return '';
}

Expand Down

0 comments on commit fc551de

Please sign in to comment.