protected function TwitterWidgetFormatter::getTweets in Twitter Profile Widget 8.2
Same name and namespace in other branches
- 3.x src/Plugin/Field/FieldFormatter/TwitterWidgetFormatter.php \Drupal\twitter_profile_widget\Plugin\Field\FieldFormatter\TwitterWidgetFormatter::getTweets()
Implements hook_preprocess_HOOK().
Take the user-entered Twitter "configuration" and return rendered tweets.
1 call to TwitterWidgetFormatter::getTweets()
- TwitterWidgetFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ TwitterWidgetFormatter.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ TwitterWidgetFormatter.php, line 76
Class
- TwitterWidgetFormatter
- Plugin implementation of the 'twitter_widget' formatter.
Namespace
Drupal\twitter_profile_widget\Plugin\Field\FieldFormatterCode
protected function getTweets($instance) {
$twitter = new TwitterProfile();
$tweets = $twitter
->pull($instance);
// If the API call returns errors, do not send any data to the template.
if ($tweets) {
return $this
->prepareTweets($tweets, $instance['count']);
}
return '';
}