class Facebook in Video Embed Facebook 8
Plugin annotation
@VideoEmbedProvider(
id = "facebook",
title = @Translation("Facebook")
)
Hierarchy
- class \Drupal\video_embed_facebook\Plugin\video_embed_field\Provider\Facebook extends \Drupal\video_embed_field\ProviderPluginBase
Expanded class hierarchy of Facebook
1 file declares its use of Facebook
- ProviderUrlParseTest.php in tests/
src/ Unit/ ProviderUrlParseTest.php
File
- src/
Plugin/ video_embed_field/ Provider/ Facebook.php, line 13
Namespace
Drupal\video_embed_facebook\Plugin\video_embed_field\ProviderView source
class Facebook extends ProviderPluginBase {
/**
* {@inheritdoc}
*/
public function renderEmbedCode($width, $height, $autoplay) {
// @todo, consider using the JavaScript version, however iframes are less
// impact to page load and also don't grant JS access to your website to
// Facebook.
return [
'#type' => 'html_tag',
'#tag' => 'iframe',
'#attributes' => [
'width' => $width,
'height' => $height,
'frameborder' => '0',
'allowfullscreen' => 'allowfullscreen',
'src' => sprintf('https://www.facebook.com/video/embed?video_id=%s', $this
->getVideoId(), $autoplay),
],
];
}
/**
* {@inheritdoc}
*/
public function getRemoteThumbnailUrl() {
return sprintf('https://graph.facebook.com/%d/picture', $this
->getVideoId());
}
/**
* {@inheritdoc}
*/
public static function getIdFromInput($input) {
preg_match('/^https?:\\/\\/(www\\.)?facebook.com\\/([\\w\\-\\.]*\\/videos\\/|video\\.php\\?v\\=)(?<id>[0-9]*)\\/?$/', $input, $matches);
return isset($matches['id']) ? $matches['id'] : FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Facebook:: |
public static | function | ||
Facebook:: |
public | function | ||
Facebook:: |
public | function |