Skip to content

Commit

Permalink
Input link types (email, phone, URL, custom) now return their raw URL…
Browse files Browse the repository at this point in the history
…s for the getText() method. Bump to 2.3.1
  • Loading branch information
mmikkel committed Jan 27, 2023
1 parent 084892e commit cbe715b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for LinkMate

## 2.3.1 - 2023-01-27
### Changed
- Input link types (email, phone, URL, custom) now return their raw URLs for the `getText()` method

## 2.3.0 - 2023-01-20
### Added
- Added the "Allow element sources without URLs" setting to entry, categories and asset link types. This setting applies when "All" is selected as the source for these element types.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/linkmate",
"description": "Let's hook you up, mate!",
"type": "craft-plugin",
"version": "2.3.0",
"version": "2.3.1",
"keywords": [
"craft",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion src/models/InputLinkType.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function getSettingsHtml(string $linkTypeName, LinkField $field): string
*/
public function getText(Link $link): ?string
{
return null;
return $this->getRawUrl($link);
}

/**
Expand Down
9 changes: 3 additions & 6 deletions src/models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,10 @@ public function getText(): ?string
return $this->customText;
}

$linkType = $this->getLinkType();
if (!is_null($linkType)) {
$linkText = $linkType->getText($this);
$linkText = $this->getLinkType()?->getText($this);

if (!is_null($linkText)) {
return $linkText;
}
if (!empty($linkText)) {
return $linkText;
}

return Craft::t('site', $this->getDefaultText());
Expand Down

0 comments on commit cbe715b

Please sign in to comment.