public static function TwitterWidgetFormatter::schemaFreeLink 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::schemaFreeLink()
Strip 'http://' and 'https://' from a url, and replace it for '//'.
1 call to TwitterWidgetFormatter::schemaFreeLink()
- TwitterWidgetFormatter::prepareTweets in src/
Plugin/ Field/ FieldFormatter/ TwitterWidgetFormatter.php - Helper to parse Twitter's JSON and return a normalized array of tweets.
File
- src/
Plugin/ Field/ FieldFormatter/ TwitterWidgetFormatter.php, line 149
Class
- TwitterWidgetFormatter
- Plugin implementation of the 'twitter_widget' formatter.
Namespace
Drupal\twitter_profile_widget\Plugin\Field\FieldFormatterCode
public static function schemaFreeLink($url) {
$schemes = [
'http://',
'https://',
];
$url = str_replace($schemes, '//', $url);
return $url;
}