You are here

private function TweetEntity::getTags in Tweet Feed 4.x

Same name and namespace in other branches
  1. 8.3 src/Entity/TweetEntity.php \Drupal\tweet_feed\Entity\TweetEntity::getTags()
2 calls to TweetEntity::getTags()
TweetEntity::getHashtags in src/Entity/TweetEntity.php
TweetEntity::getUserMentionsTags in src/Entity/TweetEntity.php

File

src/Entity/TweetEntity.php, line 291

Class

TweetEntity
Defines the Tweet Feed Tweet entity.

Namespace

Drupal\tweet_feed\Entity

Code

private function getTags($tags) {
  $hashtags = $this
    ->get($tags)
    ->getValue();
  $tags = [];
  if (!empty($hashtags)) {
    foreach ($hashtags as $key => $term) {
      $tag = $this
        ->entityTypeManager()
        ->getStorage('taxonomy_term')
        ->load($term['target_id'])->values;
      $tags[]['name'] = $tag['name']['x-default'];
      $tags[]['tid'] = $tag['tid']['x-default'];
    }
  }
  return $tags;
}