protected function UserMentionsFormatterType::viewValue in Tweet Feed 8.3
Same name and namespace in other branches
- 4.x src/Plugin/Field/FieldFormatter/UserMentionsFormatterType.php \Drupal\tweet_feed\Plugin\Field\FieldFormatter\UserMentionsFormatterType::viewValue()
Generate the output appropriate for one field item.
Parameters
\Drupal\Core\Field\FieldItemInterface $item: One field item.
Return value
string The textual output generated.
1 call to UserMentionsFormatterType::viewValue()
- UserMentionsFormatterType::viewElements in src/
Plugin/ Field/ FieldFormatter/ UserMentionsFormatterType.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ UserMentionsFormatterType.php, line 74
Class
- UserMentionsFormatterType
- Plugin implementation of the 'user_mentions_formatter_type' formatter.
Namespace
Drupal\tweet_feed\Plugin\Field\FieldFormatterCode
protected function viewValue(FieldItemInterface $item) {
$values = $item
->toArray();
$url = 'http://www.twitter.com/' . Html::escape($values['mention_screen_name']);
$display = '<div class="tweet-feed-user-mention"><a class="tweet-feed-user-mention-anchor" href="' . $url . '">' . $values['mention_name'] . '</a></div>';
return $display;
}