diff --git a/config/module.config.php b/config/module.config.php index b64ada6..307342a 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -21,6 +21,7 @@ return [ 'Render3DBlockForm' => [ 'model_type' => 'gltf', 'title' => '', + 'renderSourceLink' => true, 'width' => 600, 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', //'imgStyle' => '', diff --git a/src/Form/Render3DBlockForm.php b/src/Form/Render3DBlockForm.php index c319b8f..88db788 100644 --- a/src/Form/Render3DBlockForm.php +++ b/src/Form/Render3DBlockForm.php @@ -20,14 +20,6 @@ class Render3DBlockForm extends Form ], ]); - $this->add([ - 'name' => 'o:block[__blockIndex__][o:data][title]', - 'type' => Element\Text::class, - 'options' => [ - 'label' => 'Title (option)', - ] - ]); - $this->add([ 'name' => 'o:block[__blockIndex__][o:data][width]', 'type' => Element\Number::class, @@ -39,5 +31,23 @@ class Render3DBlockForm extends Form ], ]); + $this->add([ + 'type' => Element\Checkbox::class, + 'name' => 'o:block[__blockIndex__][o:data][renderSourceLink]', + 'options' => [ + 'label' => 'Display a link to the item', + //'use_hidden_element' => true, + 'checked_value' => true, + 'unchecked_value' => false, + ], + ]); + + $this->add([ + 'name' => 'o:block[__blockIndex__][o:data][title]', + 'type' => Element\Text::class, + 'options' => [ + 'label' => 'Sub-title', + ] + ]); } } diff --git a/src/Site/BlockLayout/Render3D.php b/src/Site/BlockLayout/Render3D.php index 4d20799..f406b57 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][renderSourceLink]' => $data['renderSourceLink'], ]); $form->prepare(); @@ -94,6 +95,8 @@ class Render3D extends AbstractBlockLayout 'title' => $block->dataValue('title'), 'width' => $width, 'height' => $height, + 'item_url' => $attachments[0]->item()->url(), + 'renderSourceLink' => $block->dataValue('renderSourceLink'), 'urls' => $urls, 'id' => 'v3d-' . ++$id, 'mediaTypes' => $media_types, diff --git a/view/common/block-layout/render-3d.phtml b/view/common/block-layout/render-3d.phtml index 29fdfc4..9816f78 100644 --- a/view/common/block-layout/render-3d.phtml +++ b/view/common/block-layout/render-3d.phtml @@ -22,7 +22,13 @@ console.log() } +
+ + +
@@ -98,6 +104,12 @@ console.log()
+ +
+ +
+ +