Skip to content

Commit

Permalink
Fix link text returning a value when an invalid link
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed May 29, 2024
1 parent 1f2302d commit c468208
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/base/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ public function getUrl(): ?string

public function getText(?string $defaultText = null): ?string
{
// If there's not a valid URL for this link, don't return text even if there is a value
if (!$this->getUrl()) {
return null;
}

$defaultText = $defaultText ?? Craft::t('hyper', 'Read more');

// Use the placeholder of the `linkText` field as fallback
Expand Down

0 comments on commit c468208

Please sign in to comment.