changes subtile attribute name

closes #1
This commit is contained in:
buttle 2021-06-28 16:37:38 +02:00
parent bf1cf9ce70
commit d57eb19a48
4 changed files with 10 additions and 15 deletions

View File

@ -24,7 +24,7 @@ return [
'perPage' => 1,
'loop' => true,
'draggable' => true,
'subTitle' => '',
'title' => '',
'renderSourceLink' => true,
'autoSlide' => false,
'autoSlideInt' => 5000,

View File

@ -108,7 +108,7 @@ class CarouselBlockForm extends Form
]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][subTitle]',
'name' => 'o:block[__blockIndex__][o:data][title]',
'type' => Element\Text::class,
'options' => [
'label' => 'Sub-title',

View File

@ -34,7 +34,7 @@ class Carousel extends AbstractBlockLayout
}
public function getLabel() {
return 'SimpleCarousel';
return 'Simple carousel';
}
public function form(PhpRenderer $view, SiteRepresentation $site,
@ -45,12 +45,12 @@ class Carousel extends AbstractBlockLayout
? $block->data() + $this->defaultSettings
: $this->defaultSettings;
$form->setData([
'o:block[__blockIndex__][o:data][title]' => $data['title'],
'o:block[__blockIndex__][o:data][height]' => $data['height'],
'o:block[__blockIndex__][o:data][duration]' => $data['duration'],
'o:block[__blockIndex__][o:data][perPage]' => $data['perPage'],
'o:block[__blockIndex__][o:data][loop]' => $data['loop'],
'o:block[__blockIndex__][o:data][draggable]' => $data['draggable'],
'o:block[__blockIndex__][o:data][subTitle]' => $data['subTitle'],
'o:block[__blockIndex__][o:data][autoSlide]' => $data['autoSlide'],
'o:block[__blockIndex__][o:data][autoSlideInt]' => $data['autoSlideInt'],
'o:block[__blockIndex__][o:data][wrapStyle]' => $data['wrapStyle'],
@ -100,7 +100,7 @@ class Carousel extends AbstractBlockLayout
'perPage' => $block->dataValue('perPage'),
'loop' => $block->dataValue('loop'),
'draggable' => $block->dataValue('draggable'),
'subTitle' => $block->dataValue('subTitle'),
'title' => $block->dataValue('title'),
'images' => $images,
'autoSlide' => $block->dataValue('autoSlide'),
'autoSlideInt' => $block->dataValue('autoSlideInt'),

View File

@ -2,9 +2,6 @@
<?php
$this->headLink()->appendStylesheet($this->assetUrl('css/carousel.css', 'SimpleCarousel'));
$this->headScript()->appendFile($this->assetUrl('js/siema.min.js', 'SimpleCarousel'));
$title = false;
$caret = sprintf('<img class="caret" id="left" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
$caret_r = sprintf('<img class="caret" id="right" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
?>
@ -41,10 +38,11 @@
</div>
<div id="siema-ui"></div>
</div>
<?php if ($subTitle) { ?>
<div class="item_title">
<?= $subTitle ?>
</div>
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
</div>
<?php } ?>
</div>
@ -71,9 +69,6 @@ $(document).ready(function() {
let caret_r = '<?php echo $caret_r;?>';
$('#siema-ui').append(caret);
<?php if ($title !== false): ?>
$('#siema-ui').append('<?php echo $title;?>');
<?php endif ?>
$('#siema-ui').append(caret_r);
$('.caret#left').click(function () {siema.prev()});