public static function TwitterWidgetFormatter::schemaFreeLink in Twitter Profile Widget 3.x
Same name and namespace in other branches
- 8.2 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 148
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;
}