From 1028adab8aa6b41e9aa860783888ce0b31358f85 Mon Sep 17 00:00:00 2001 From: buttle Date: Sun, 27 Jun 2021 13:45:44 +0200 Subject: [PATCH] adds item source link and item subtitile --- config/module.config.php | 1 + src/Form/ArchiveOrgBlockForm.php | 27 ++++++++++++++++------- src/Site/BlockLayout/ArchiveOrg.php | 3 +++ view/common/block-layout/archiveOrg.phtml | 12 ++++++++++ 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/config/module.config.php b/config/module.config.php index dae5a19..bf03b60 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -31,6 +31,7 @@ return [ 'ArchiveOrgBlockForm' => [ 'media_type' => 'video', 'title' => '', + 'renderSourceLink' => true, 'width' => 600, 'ratio' => '2', 'autoLoad' => false, diff --git a/src/Form/ArchiveOrgBlockForm.php b/src/Form/ArchiveOrgBlockForm.php index 7d950c9..6981c86 100644 --- a/src/Form/ArchiveOrgBlockForm.php +++ b/src/Form/ArchiveOrgBlockForm.php @@ -10,14 +10,6 @@ class ArchiveOrgBlockForm extends Form public function init() { - $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][media_type]', 'type' => Element\Select::class, @@ -47,5 +39,24 @@ class ArchiveOrgBlockForm 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/ArchiveOrg.php b/src/Site/BlockLayout/ArchiveOrg.php index da9dcd5..c91b691 100644 --- a/src/Site/BlockLayout/ArchiveOrg.php +++ b/src/Site/BlockLayout/ArchiveOrg.php @@ -51,6 +51,7 @@ class ArchiveOrg extends AbstractBlockLayout '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'], ]); $form->prepare(); @@ -80,6 +81,8 @@ class ArchiveOrg extends AbstractBlockLayout return $view->partial('common/block-layout/archiveOrg', [ 'media_type' => $block->dataValue('media_type'), 'title' => $block->dataValue('title'), + 'renderSourceLink' => $block->dataValue('renderSourceLink'), + 'item_url' => $attachments[0]->item()->url(), 'width' => $width, 'height' => $height, 'url' => $media->source(), diff --git a/view/common/block-layout/archiveOrg.phtml b/view/common/block-layout/archiveOrg.phtml index 4fb4f5d..9cd09d6 100644 --- a/view/common/block-layout/archiveOrg.phtml +++ b/view/common/block-layout/archiveOrg.phtml @@ -1,5 +1,11 @@
+ + + + %s

', $title); @@ -26,4 +32,10 @@ allowfullscreen > + +
+ +
+ +