From fd225e386b1b23fc1d7a208d63413c3b8344d6c8 Mon Sep 17 00:00:00 2001 From: buttle Date: Tue, 22 Jun 2021 11:53:13 +0200 Subject: [PATCH] forces iframe width with jquery --- Module.php | 6 ++++++ config/module.config.php | 1 + src/Site/BlockLayout/Sketchfab.php | 4 ++++ view/common/block-layout/sketchfab.phtml | 11 ++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Module.php b/Module.php index e75640a..0910944 100644 --- a/Module.php +++ b/Module.php @@ -9,6 +9,12 @@ class Module extends AbstractModule { const NAMESPACE = __NAMESPACE__; + const RATIOS = [ + '1.777' => '16:9', + '1.333' => '4:3', + '2' => '2:1', + ]; + public function getConfig() { return include __DIR__ . '/config/module.config.php'; diff --git a/config/module.config.php b/config/module.config.php index b3f08a0..d1d5aa7 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -31,6 +31,7 @@ return [ 'SketchfabBlockForm' => [ 'title' => '', 'width' => 600, + 'ratio' => '2', 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', ] ] diff --git a/src/Site/BlockLayout/Sketchfab.php b/src/Site/BlockLayout/Sketchfab.php index e78fb64..e54fdf4 100644 --- a/src/Site/BlockLayout/Sketchfab.php +++ b/src/Site/BlockLayout/Sketchfab.php @@ -75,8 +75,12 @@ class Sketchfab extends AbstractBlockLayout static $id = 0; $media = $attachments[0]->item()->media()[0]; + $width = 900; + $height = $width / $block->dataValue('ratio'); return $view->partial('common/block-layout/sketchfab', [ 'title' => false, + 'width' => $width, + 'height' => $height, 'sketchfab_iframe' => $media->mediaData()['html'], ]); //return $media->mediaData()['html']; diff --git a/view/common/block-layout/sketchfab.phtml b/view/common/block-layout/sketchfab.phtml index a22746e..55e01ec 100644 --- a/view/common/block-layout/sketchfab.phtml +++ b/view/common/block-layout/sketchfab.phtml @@ -1,4 +1,4 @@ -
+
+ + +