Skip to content

Instantly share code, notes, and snippets.

@kporras07
Created April 19, 2017 18:08
Show Gist options
  • Save kporras07/12ad69287e95d999587af1962b90897b to your computer and use it in GitHub Desktop.
Save kporras07/12ad69287e95d999587af1962b90897b to your computer and use it in GitHub Desktop.
View Value function in email field formatter
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