diff --git a/config/module.config.php b/config/module.config.php index 3077414..bef61b2 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -19,10 +19,9 @@ return [ ], 'DefaultSettings' => [ 'PDFLinkBlockForm' => [ - 'title' => '', + 'link_name' => '', 'renderSourceLink' => true, - 'width' => 600, - 'zoom_type' => '', + 'description_text' => '', 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', ] ] diff --git a/config/module.ini b/config/module.ini index 328a002..c909d1c 100644 --- a/config/module.ini +++ b/config/module.ini @@ -1,5 +1,5 @@ [info] -name = "Image viewer" +name = "PDF link" description = "View and optionally zoom images" tags = "" license = "MIT" diff --git a/src/Form/PDFLinkBlockForm.php b/src/Form/PDFLinkBlockForm.php index 8316c26..e7c15d7 100644 --- a/src/Form/PDFLinkBlockForm.php +++ b/src/Form/PDFLinkBlockForm.php @@ -11,40 +11,15 @@ class PDFLinkBlockForm extends Form { $this->add([ - 'name' => 'o:block[__blockIndex__][o:data][width]', - 'type' => Element\Select::class, - 'options' => [ - 'label' => 'Width', - 'value_options' => Module::IMAGE_WIDTH, - ], - ]); - - $this->add([ - 'name' => 'o:block[__blockIndex__][o:data][zoom_type]', - 'type' => Element\Select::class, - 'options' => [ - 'label' => 'Zooming', - 'value_options' => Module::ZOOM_TYPE, - ], - ]); - - $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', - ] + 'name' => 'o:block[__blockIndex__][o:data][description_text]', + 'type' => Element\Textarea::class, + 'options' => [ + 'label' => 'Short summary', + ], + 'attributes' => [ + 'rows' => '10', + ], ]); + } } diff --git a/src/Site/BlockLayout/PDFLink.php b/src/Site/BlockLayout/PDFLink.php index 018d42c..0d23d71 100644 --- a/src/Site/BlockLayout/PDFLink.php +++ b/src/Site/BlockLayout/PDFLink.php @@ -34,7 +34,7 @@ class PDFLink extends AbstractBlockLayout } public function getLabel() { - return 'Image viewer'; + return 'PDF link'; } public function form(PhpRenderer $view, @@ -47,10 +47,7 @@ class PDFLink extends AbstractBlockLayout ? $block->data() + $this->defaultSettings : $this->defaultSettings; $form->setData([ - 'o:block[__blockIndex__][o:data][title]' => $data['title'], - 'o:block[__blockIndex__][o:data][width]' => $data['width'], - 'o:block[__blockIndex__][o:data][zoom_type]' => $data['zoom_type'], - 'o:block[__blockIndex__][o:data][renderSourceLink]' => $data['renderSourceLink'], + 'o:block[__blockIndex__][o:data][description_text]' => $data['description_text'], ]); $form->prepare(); @@ -71,18 +68,15 @@ class PDFLink extends AbstractBlockLayout return ''; } - $thumbnails = []; static $id = 0; $media = $attachments[0]->item()->media()[0]; return $view->partial('common/block-layout/pDFLink', [ - 'zoom_type' => $block->dataValue('zoom_type'), - 'title' => $block->dataValue('title'), + 'description_text' => $block->dataValue('description_text'), + 'link_name' => $media->displayTitle(), 'item_url' => $attachments[0]->item()->url(), - 'renderSourceLink' => $block->dataValue('renderSourceLink'), - 'width' => $block->dataValue('width'), - 'image' => $media->primaryMedia()->thumbnailUrl('large'), - 'id' => 'iv-' . ++$id, + 'pdf_url' => $media->originalUrl(), + 'id' => 'pdf-' . ++$id, ]); } } diff --git a/view/common/block-layout/pDFLink.phtml b/view/common/block-layout/pDFLink.phtml index f4ee1e2..54941b6 100644 --- a/view/common/block-layout/pDFLink.phtml +++ b/view/common/block-layout/pDFLink.phtml @@ -1,68 +1,6 @@ -headScript()->appendFile($this->assetUrl('vendor/wheelzoom/wheelzoom.js', - 'PDFLink')); - } - if ($zoom_type == "zoom") { - $this->headScript()->appendFile($this->assetUrl('vendor/zoom/jquery.zoom.min.js', - 'PDFLink')); - } - if ($zoom_type == "zoom" || $zoom_type == "wheelzoom") { - $this->headLink()->appendStylesheet($this->assetUrl('css/zoom.css', - 'PDFLink')); - } -?> - - - - - - - -
- <?= $title ?> -
- - - -
- -
- - - -
- -
- - - -
- -
- - - - - - - - - - - +
+
+ .pdf +