Compare commits
No commits in common. "415df49b47165c419064551fe607e477f3d23cc8" and "9e9a5829f7872fc3e913ab7031acf25c0a26c747" have entirely different histories.
415df49b47
...
9e9a5829f7
|
@ -9,19 +9,12 @@ class Module extends AbstractModule
|
|||
{
|
||||
const NAMESPACE = __NAMESPACE__;
|
||||
|
||||
const IMAGE_WIDTH = [
|
||||
'25' => '25 %',
|
||||
'50' => '50 %',
|
||||
'75' => '75 %',
|
||||
'100' => '100 %',
|
||||
];
|
||||
/*
|
||||
const RATIOS = [
|
||||
'1.777' => '16:9',
|
||||
'1.333' => '4:3',
|
||||
'2' => '2:1',
|
||||
];
|
||||
*/
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
return include __DIR__ . '/config/module.config.php';
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
function get_height(container, ratio) {
|
||||
var height = $(container).width() / ratio
|
||||
return height
|
||||
}
|
|
@ -31,7 +31,7 @@ return [
|
|||
'VimeoBlockForm' => [
|
||||
'title' => '',
|
||||
'renderSourceLink' => true,
|
||||
'width' => 100,
|
||||
'width' => 600,
|
||||
'ratio' => '2',
|
||||
'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;',
|
||||
]
|
||||
|
|
|
@ -12,16 +12,13 @@ class VimeoBlockForm extends Form
|
|||
|
||||
$this->add([
|
||||
'name' => 'o:block[__blockIndex__][o:data][width]',
|
||||
'type' => Element\Select::class,
|
||||
'type' => Element\Number::class,
|
||||
'options' => [
|
||||
'label' => 'Width',
|
||||
'value_options' => Module::IMAGE_WIDTH,
|
||||
'label' => 'Width in pixels',
|
||||
],
|
||||
/*
|
||||
'attributes' => [
|
||||
'min' => '100',
|
||||
],
|
||||
*/
|
||||
]);
|
||||
|
||||
$this->add([
|
||||
|
|
|
@ -75,17 +75,15 @@ class Vimeo extends AbstractBlockLayout
|
|||
static $id = 0;
|
||||
|
||||
$media = $attachments[0]->item()->media()[0];
|
||||
$vimeo_width = $media->mediaData()['width'];
|
||||
$vimeo_height = $media->mediaData()['height'];
|
||||
$ratio = $vimeo_width / $vimeo_height;
|
||||
|
||||
$width = 900;
|
||||
//$height = $width / $block->dataValue('ratio');
|
||||
$height = $width / 1.333;
|
||||
return $view->partial('common/block-layout/vimeo', [
|
||||
'title' => $block->dataValue('title'),
|
||||
'renderSourceLink' => $block->dataValue('renderSourceLink'),
|
||||
'item_url' => $attachments[0]->item()->url(),
|
||||
'width' => $block->dataValue('width'),
|
||||
'video_id' => $media->mediaData()['video_id'],
|
||||
'ratio' => $ratio,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'vimeo_iframe' => $media->mediaData()['html'],
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
<?php
|
||||
$this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
|
||||
'Vimeo'));
|
||||
?>
|
||||
|
||||
<div id="vimeo_<?= $video_id ?>" class="vimeo-wrap" style="position:relative;">
|
||||
<div class="vimeo-wrap" style="position:relative;">
|
||||
|
||||
<?php if ($renderSourceLink) { ?>
|
||||
<div class="source-link">
|
||||
|
@ -21,11 +16,11 @@ $this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var vimeo = $("#vimeo_<?= $video_id ?>").find('iframe');
|
||||
$(vimeo).prop("width", "<?= $width ?>%")
|
||||
var height = get_height(vimeo, <?= $ratio ?>)
|
||||
$(vimeo).prop("height", height)
|
||||
var vimeo = $(".vimeo-wrap").find('iframe');
|
||||
//$(vimeo).prop('width', <?= $width ?>);
|
||||
//$(vimeo).prop('height', <?= $height ?>);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue