Closed stroebjo closed 4 years ago
I don't think that is currently intended. But if you can create such a template, feel free to provide it here and I can include it in a future version 😊
Oh okay. I looked around in the template, but I didn't find any hints on how to get all images, based on the information available in the template.
Am I correct in the assumption to make this work I would have to create a ModulePageAllImages.php
, register it in all the config arrays, call the PageImage::getMultiple()
and render my new template?
Okay, I investigated the template options and got it working, somehow. ;)
It doesn't seem to fetch alt
/title
information from the media manager.
Altered mod_pageimage.html5
:
<?php
// fetch images
global $objPage;
$arrImages = PageImage::getMultiple($objPage);
if (count($arrImages) > 0) { ?>
<!-- indexer::stop -->
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<!-- Slider main container -->
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<?php foreach($arrImages as $image) { ?>
<div class="swiper-slide">
<figure class="image_container">
<?php
$objFile = FilesModel::findByUuid($image['uuid']);
$picture = \Picture::create($objFile->path, 1)->getTemplateData();
$this->insert('picture_default', $picture);//bild ausgeben
?>
</figure>
</div>
<?php } ?>
</div>
</div>
</div>
<!-- indexer::continue -->
<?php } ?>
I'm not exactly sure if this is a proper solution. But it works for my use case.
The file picker in the backend supports multiple files (#25). I'm wondering how to access all images in a loop, to create a custom slider. Inside the
templates/
directory are to example files, I think it would be great to have a third with an loop over all selected images as reference for custom implementations.I'm using Contao 4.5.4 with PageImage 3.3.1.