Coub.php in Video Filter 8
File
src/Plugin/VideoFilter/Coub.php
View source
<?php
namespace Drupal\video_filter\Plugin\VideoFilter;
use Drupal\video_filter\VideoFilterBase;
class Coub extends VideoFilterBase {
public function iframe($video) {
$attributes = [
'autostart' => !empty($video['autoplay']) ? 'autoplay=true' : 'autoplay=false',
'originalSize' => !empty($video['originalSize']) ? 'originalSize=true' : 'originalSize=false',
'startWithHD' => !empty($video['startWithHD']) ? 'startWithHD=true' : 'startWithHD=false',
'muted' => !empty($video['muted']) ? 'muted=true' : 'muted=false',
];
return [
'src' => '//coub.com/embed/' . $video['codec']['matches'][1] . '?' . implode('&', $attributes),
'properties' => [
'allowfullscreen' => 'true',
],
];
}
public function options() {
$form = parent::options();
$form['autoplay'] = [
'#title' => $this
->t('Autoplay (optional)'),
'#type' => 'checkbox',
];
$form['originalSize'] = [
'#title' => $this
->t('Show original size (optional)'),
'#type' => 'checkbox',
];
$form['startWithHD'] = [
'#title' => $this
->t('Start with HD (optional)'),
'#type' => 'checkbox',
];
$form['muted'] = [
'#title' => $this
->t('Muted (optional)'),
'#type' => 'checkbox',
];
return $form;
}
}
Classes
Name |
Description |
Coub |
Provides Coub codec for Video Filter. |