Skip to content

Commit

Permalink
[5.x] Handle entries in Link field with is_external_url modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ammonitedigital authored May 14, 2024
1 parent b65a7f1 commit 3b559f8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Modifiers/CoreModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Support\Facades\Date;
use Statamic\Contracts\Assets\Asset as AssetContract;
use Statamic\Contracts\Data\Augmentable;
use Statamic\Contracts\Entries\Entry;
use Statamic\Facades\Antlers;
use Statamic\Facades\Asset;
use Statamic\Facades\Compare;
Expand Down Expand Up @@ -1268,6 +1269,10 @@ public function isExternalUrl($value)
$value = $value->value();
}

if ($value instanceof Entry) {
$value = $value->absoluteUrl();
}

return Str::isUrl($value) && URL::isExternal($value);
}

Expand Down

0 comments on commit 3b559f8

Please sign in to comment.