class Instagram in Video 8
Same name and namespace in other branches
- 8.2 src/Plugin/video/Provider/Instagram.php \Drupal\video\Plugin\video\Provider\Instagram
Plugin annotation
@VideoEmbeddableProvider(
id = "instagram",
label = @Translation("Instagram"),
description = @Translation("Instagram Video Provider"),
regular_expressions = {
"@^.*?instagram\.com\/p\/(?<id>(.*?))[\/]?$@i",
},
mimetype = "video/instagram",
stream_wrapper = "instagram"
)
Hierarchy
- class \Drupal\video\ProviderPluginBase implements ContainerFactoryPluginInterface, ProviderPluginInterface
- class \Drupal\video\Plugin\video\Provider\Instagram
Expanded class hierarchy of Instagram
1 string reference to 'Instagram'
- InstagramStream::getName in src/
StreamWrapper/ InstagramStream.php - Returns the name of the stream wrapper for use in the UI.
File
- src/
Plugin/ video/ Provider/ Instagram.php, line 19
Namespace
Drupal\video\Plugin\video\ProviderView source
class Instagram extends ProviderPluginBase {
/**
* {@inheritdoc}
*/
public function renderEmbedCode($settings) {
$file = $this
->getVideoFile();
$data = $this
->getVideoMetadata();
return [
'#type' => 'html_tag',
'#tag' => 'iframe',
'#attributes' => [
'width' => $settings['width'],
'height' => '100%',
'frameborder' => '0',
'allowfullscreen' => 'allowfullscreen',
'src' => sprintf('//instagram.com/p/%s/embed/?autoplay=%d', $data['id'], $settings['autoplay']),
],
'0' => [
'#type' => 'html_tag',
'#tag' => 'script',
'#attributes' => [
'type' => 'text/javascript',
'src' => '//platform.instagram.com/en_US/embeds.js',
'async',
'defer',
],
'#value' => '',
],
];
}
/**
* {@inheritdoc}
*/
public function getRemoteThumbnailUrl() {
$data = $this
->getVideoMetadata();
return 'http://instagr.am/p/' . $data['id'] . '/media/?size=l';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Instagram:: |
public | function |
Get the URL of the remote thumbnail. Overrides ProviderPluginInterface:: |
|
Instagram:: |
public | function |
Render embed code. Overrides ProviderPluginInterface:: |
|
ProviderPluginBase:: |
protected | property | File object to handle | |
ProviderPluginBase:: |
protected | property | An http client. | |
ProviderPluginBase:: |
protected | property | Additional metadata for the embedded video object | |
ProviderPluginBase:: |
protected | property | Additional settings for the video widget | |
ProviderPluginBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
ProviderPluginBase:: |
protected | function | Download the remote thumbnail to the local file system. | |
ProviderPluginBase:: |
public | function | Get the URL to the local thumbnail. | |
ProviderPluginBase:: |
protected | function | Determines the URI for a video field. | |
ProviderPluginBase:: |
protected | function | Get the ID of the video. | |
ProviderPluginBase:: |
protected | function | Get the input which caused this plugin to be selected. | |
ProviderPluginBase:: |
protected | function | Get the input which caused this plugin to be selected. | |
ProviderPluginBase:: |
public | function | ||
ProviderPluginBase:: |
public | function | Create a plugin with the given input. |