protected function TwitterWidgetFormatter::getViewAll 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::getViewAll()
Helper function to prepare the "View all" link.
1 call to TwitterWidgetFormatter::getViewAll()
- 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 54
Class
- TwitterWidgetFormatter
- Plugin implementation of the 'twitter_widget' formatter.
Namespace
Drupal\twitter_profile_widget\Plugin\Field\FieldFormatterCode
protected function getViewAll($instance) {
if (!empty($instance['view_all'])) {
if ($instance['list_type'] = 'search') {
$params = [
'q' => $instance['search'],
];
$getfield = '?' . http_build_query($params);
$url = Url::fromUri('https://twitter.com/search' . $getfield);
}
else {
$url = Url::fromUri('https://twitter.com/' . $instance['account']);
}
return Link::fromTextAndUrl($instance['view_all'], $url);
}
return '';
}