You are here

twitter_widget.html.twig in Twitter Profile Widget 8

twitter_widget.html.twig Default theme implementation to present Twitter widget data.

This template is used when viewing Twitter widget entities.

Available variables:

  • headline: A plaintext string to appear above the tweets
  • attributes: HTML attributes for the container element.
  • tweets: an array of prepared tweet data, consisting of:
  • - retweet_user: the handle of the retweeter
  • - retweet_link: a retweet link
  • - author: the display name
  • - username: the Twitter handle
  • - timestamp: the post timestamp
  • - time_ago: the post date, in "time ago" format
  • - text: the tweet itself
  • - tweet_reply2: a reply2 link
  • - tweet_retweet: a retweet link
  • - tweet_star: a "favorite" link
  • view_all: A link back to Twitter with user-supplied text

File

templates/twitter_widget.html.twig
View source
  1. {#
  2. /**
  3. * @file twitter_widget.html.twig
  4. * Default theme implementation to present Twitter widget data.
  5. *
  6. * This template is used when viewing Twitter widget entities.
  7. *
  8. * Available variables:
  9. * - headline: A plaintext string to appear above the tweets
  10. * - attributes: HTML attributes for the container element.
  11. * - tweets: an array of prepared tweet data, consisting of:
  12. * - - retweet_user: the handle of the retweeter
  13. * - - retweet_link: a retweet link
  14. * - - author: the display name
  15. * - - username: the Twitter handle
  16. * - - timestamp: the post timestamp
  17. * - - time_ago: the post date, in "time ago" format
  18. * - - text: the tweet itself
  19. * - - tweet_reply2: a reply2 link
  20. * - - tweet_retweet: a retweet link
  21. * - - tweet_star: a "favorite" link
  22. * - view_all: A link back to Twitter with user-supplied text
  23. *
  24. * @see template_preprocess_twitter_widget()
  25. *
  26. * @ingroup themeable
  27. */
  28. #}
  29. {{ attach_library('twitter_profile_widget/twitter-profile-widget') }}
  30. <div{{ attributes.addClass('twitter_widget') }}>
  31. {% if headline %}
  32. <h3 class="headline"> {{ headline }} </h3>
  33. {% endif %}
  34. {% if tweets %}
  35. {% for key,tweet in tweets %}
  36. <div class="tweet" id="tweet-{{ key }}'">
  37. {% if tweet.retweet_user %}
  38. <div class="retweet-eyebrow"><a href="{{ tweet.retweet_link }}">&#x21c4; {{ tweet.retweet_user }}</div>
  39. {% endif %}
  40. <div class="tweet-image"><img src="{{ tweet.image }}" alt="{{ tweet.image_user }}" /></div>
  41. <div class="tweet-author">{{ tweet.author }}</div>
  42. <div class="tweet-username">{{ tweet.username }}</div>
  43. <div class="tweet-text">{{ tweet.text|raw }}</div>
  44. <div class="tweet-time">{{ tweet.time_ago }}</div>
  45. <ul class="tweet-actions">
  46. <li class="tweet-action"><a class="action-link icon-reply2" href="{{ tweet.tweet_reply2 }}" title="Reply">&#x21ba;</a></li>
  47. <li class="tweet-action"><a class="action-link icon-retweet" href="{{ tweet.tweet_retweet }}" title="Retweet">&#x21c4;</a></li>
  48. <li class="tweet-action"><a class="action-link icon-star" href="{{ tweet.tweet_star }}" title="Favorite">&#x2606;</a></li>
  49. </ul>
  50. </div>
  51. {% endfor %}
  52. {% endif %}
  53. {% if view_all %}
  54. <div class="view-all">{{ view_all }}</div>
  55. {% endif %}
  56. </div>