Created
April 19, 2017 18:08
-
-
Save kporras07/12ad69287e95d999587af1962b90897b to your computer and use it in GitHub Desktop.
View Value function in email field formatter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function viewValue(FieldItemInterface $item) { | |
// The text value has no text format assigned to it, so the user input | |
// should equal the output, including newlines. | |
$url = Url::fromUri('mailto:' . $item->value); | |
return Link::fromTextAndUrl(t('Send Email'), $url)->toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment