adds item source link and item subtitile

This commit is contained in:
buttle 2021-06-27 13:45:44 +02:00
parent 76e5b24bdc
commit 1028adab8a
4 changed files with 35 additions and 8 deletions

View File

@ -31,6 +31,7 @@ return [
'ArchiveOrgBlockForm' => [ 'ArchiveOrgBlockForm' => [
'media_type' => 'video', 'media_type' => 'video',
'title' => '', 'title' => '',
'renderSourceLink' => true,
'width' => 600, 'width' => 600,
'ratio' => '2', 'ratio' => '2',
'autoLoad' => false, 'autoLoad' => false,

View File

@ -10,14 +10,6 @@ class ArchiveOrgBlockForm extends Form
public function init() public function init()
{ {
$this->add([
'name' => 'o:block[__blockIndex__][o:data][title]',
'type' => Element\Text::class,
'options' => [
'label' => 'Title (option)',
]
]);
$this->add([ $this->add([
'name' => 'o:block[__blockIndex__][o:data][media_type]', 'name' => 'o:block[__blockIndex__][o:data][media_type]',
'type' => Element\Select::class, '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',
]
]);
} }
} }

View File

@ -51,6 +51,7 @@ class ArchiveOrg extends AbstractBlockLayout
'o:block[__blockIndex__][o:data][title]' => $data['title'], 'o:block[__blockIndex__][o:data][title]' => $data['title'],
'o:block[__blockIndex__][o:data][width]' => $data['width'], 'o:block[__blockIndex__][o:data][width]' => $data['width'],
'o:block[__blockIndex__][o:data][ratio]' => $data['ratio'], 'o:block[__blockIndex__][o:data][ratio]' => $data['ratio'],
'o:block[__blockIndex__][o:data][renderSourceLink]' => $data['renderSourceLink'],
]); ]);
$form->prepare(); $form->prepare();
@ -80,6 +81,8 @@ class ArchiveOrg extends AbstractBlockLayout
return $view->partial('common/block-layout/archiveOrg', [ return $view->partial('common/block-layout/archiveOrg', [
'media_type' => $block->dataValue('media_type'), 'media_type' => $block->dataValue('media_type'),
'title' => $block->dataValue('title'), 'title' => $block->dataValue('title'),
'renderSourceLink' => $block->dataValue('renderSourceLink'),
'item_url' => $attachments[0]->item()->url(),
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
'url' => $media->source(), 'url' => $media->source(),

View File

@ -1,5 +1,11 @@
<div class="archive_org-wrap" style="position:relative;"> <div class="archive_org-wrap" style="position:relative;">
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<?php <?php
if ($title !== false && $title !== "") { if ($title !== false && $title !== "") {
$title = sprintf('<p id="achive_org_media-title">%s</p>', $title); $title = sprintf('<p id="achive_org_media-title">%s</p>', $title);
@ -26,4 +32,10 @@
allowfullscreen > allowfullscreen >
</iframe> </iframe>
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
</div>
<?php } ?>
</div> </div>