From ae13afa4454a4bf476d2d790be1a6f21720d2a4a Mon Sep 17 00:00:00 2001 From: buttle Date: Wed, 6 Oct 2021 13:13:35 +0200 Subject: [PATCH] adds ratio otion --- Module.php | 5 +++++ config/module.config.php | 1 + src/Form/Render3DBlockForm.php | 9 +++++++++ src/Site/BlockLayout/Render3D.php | 2 ++ 4 files changed, 17 insertions(+) diff --git a/Module.php b/Module.php index c9b146e..88f48bd 100644 --- a/Module.php +++ b/Module.php @@ -28,6 +28,11 @@ class Module extends AbstractModule '100' => '100 %', ]; + const RATIO = [ + '2' => '2:1', + '1.333' => '4:3', + '1.777' => '16:9' + ]; public function getConfig() { diff --git a/config/module.config.php b/config/module.config.php index d1567ee..2bea2eb 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -24,6 +24,7 @@ return [ 'renderSourceLink' => true, //'addPreLoadImage' => true, 'width' => 600, + 'ratio' => '1.333', 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', 'ui_background' => 'rgba(0,0,0,0.1)', ] diff --git a/src/Form/Render3DBlockForm.php b/src/Form/Render3DBlockForm.php index b609ad7..dfbdac0 100644 --- a/src/Form/Render3DBlockForm.php +++ b/src/Form/Render3DBlockForm.php @@ -29,6 +29,15 @@ class Render3DBlockForm extends Form ], ]); + $this->add([ + 'name' => 'o:block[__blockIndex__][o:data][ratio]', + 'type' => Element\Select::class, + 'options' => [ + 'label' => 'Ratio', + 'value_options' => Module::RATIO, + ], + ]); + $this->add([ 'type' => Element\Checkbox::class, 'name' => 'o:block[__blockIndex__][o:data][renderSourceLink]', diff --git a/src/Site/BlockLayout/Render3D.php b/src/Site/BlockLayout/Render3D.php index 96e72d1..60821bb 100644 --- a/src/Site/BlockLayout/Render3D.php +++ b/src/Site/BlockLayout/Render3D.php @@ -50,6 +50,7 @@ class Render3D extends AbstractBlockLayout 'o:block[__blockIndex__][o:data][model_type]' => $data['model_type'], 'o:block[__blockIndex__][o:data][title]' => $data['title'], 'o:block[__blockIndex__][o:data][width]' => $data['width'], + 'o:block[__blockIndex__][o:data][ratio]' => $data['ratio'], 'o:block[__blockIndex__][o:data][renderSourceLink]' => $data['renderSourceLink'], //'o:block[__blockIndex__][o:data][addPreLoadImage]' => $data['addPreLoadImage'], ]); @@ -101,6 +102,7 @@ class Render3D extends AbstractBlockLayout 'model_type' => $model_type, 'title' => $block->dataValue('title'), 'width' => $width, + 'ratio' => $block->dataValue('ratio'), 'height' => $height, 'item_url' => $attachments[0]->item()->url(), 'renderSourceLink' => $block->dataValue('renderSourceLink'),