protected function YouTube::getLanguagePreference in Video Embed Field 8.2
Same name and namespace in other branches
- 8 src/Plugin/video_embed_field/Provider/YouTube.php \Drupal\video_embed_field\Plugin\video_embed_field\Provider\YouTube::getLanguagePreference()
Extract the language preference from the URL for use in closed captioning.
Return value
string|FALSE The language preference if one exists or FALSE if one could not be found.
1 call to YouTube::getLanguagePreference()
- YouTube::renderEmbedCode in src/
Plugin/ video_embed_field/ Provider/ YouTube.php - Render embed code.
File
- src/
Plugin/ video_embed_field/ Provider/ YouTube.php, line 65
Class
- YouTube
- A YouTube provider plugin.
Namespace
Drupal\video_embed_field\Plugin\video_embed_field\ProviderCode
protected function getLanguagePreference() {
preg_match('/[&\\?]hl=(?<language>[a-z\\-]*)/', $this
->getInput(), $matches);
return isset($matches['language']) ? $matches['language'] : FALSE;
}