You are here

public function TweetEntity::setUserMentions in Tweet Feed 8.3

Same name and namespace in other branches
  1. 4.x src/Entity/TweetEntity.php \Drupal\tweet_feed\Entity\TweetEntity::setUserMentions()

File

src/Entity/TweetEntity.php, line 328

Class

TweetEntity
Defines the Tweet Feed Tweet entity.

Namespace

Drupal\tweet_feed\Entity

Code

public function setUserMentions($user_mentions) {
  $um = [];
  if (count($user_mentions) > 0) {
    foreach ($user_mentions as $user_mention) {
      $um[] = [
        'mention_name' => tweet_feed_filter_iconv_text(tweet_feed_filter_smart_quotes($user_mention->name)),
        'mention_screen_name' => tweet_feed_filter_iconv_text(tweet_feed_filter_smart_quotes($user_mention->screen_name)),
        'mention_id' => $user_mention->id_str,
      ];
    }
  }
  $this
    ->set('user_mentions', $um);
}