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, 'perPage' => 1,
'loop' => true, 'loop' => true,
'draggable' => true, 'draggable' => true,
'subTitle' => '', 'title' => '',
'renderSourceLink' => true, 'renderSourceLink' => true,
'autoSlide' => false, 'autoSlide' => false,
'autoSlideInt' => 5000, 'autoSlideInt' => 5000,

View File

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

View File

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

View File

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