Add gallery images to concept detail page

This commit is contained in:
Björn Fromme
2022-08-22 16:32:34 +02:00
parent 647ed4b6c9
commit 23d5f7f008
4 changed files with 124 additions and 40 deletions
@@ -90,6 +90,11 @@ class Concept extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
*/ */
protected $headerImages; protected $headerImages;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
protected $images;
/** /**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product> * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
*/ */
@@ -110,6 +115,7 @@ class Concept extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
$this->products = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->products = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->teaserImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->teaserImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->headerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->headerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
} }
/** /**
@@ -326,6 +332,22 @@ class Concept extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
$this->headerImages = $headerImages; $this->headerImages = $headerImages;
} }
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getImages()
{
return $this->images;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $images
*/
public function setImages($images)
{
$this->images = $images;
}
/** /**
* @param \EP\EpProducts\Domain\Model\Product $product * @param \EP\EpProducts\Domain\Model\Product $product
*/ */
@@ -25,7 +25,7 @@ return [
'types' => [ 'types' => [
'1' => [ '1' => [
'showitem' => '--palette--;;top, --palette--;;naming, --palette--;;header, teaser, description, description_extended, 'showitem' => '--palette--;;top, --palette--;;naming, --palette--;;header, teaser, description, description_extended,
--div--;Bilder/Dateien, teaser_images, header_images', --div--;Bilder/Dateien, teaser_images, header_images, images',
], ],
], ],
'palettes' => [ 'palettes' => [
@@ -310,6 +310,55 @@ return [
], ],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
), ),
],
'images' => [
'exclude' => 0,
'label' => 'Galeriebilder',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette',
],
],
'columns' => [
'crop' => [
'config' => [
'cropVariants' => [
'default' => [
'title' => 'Preview',
'allowedAspectRatios' => [
'preview' => [
'title' => 'Standard',
'value' => 1.8,
],
],
],
'zoom' => [
'title' => 'Zoom',
'allowedAspectRatios' => [
'free' => [
'title' => 'frei',
'value' => 'NaN',
],
],
],
],
],
],
],
],
'maxitems' => 10
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
], ],
'products' => [ 'products' => [
'exclude' => 0, 'exclude' => 0,
@@ -529,6 +529,7 @@ CREATE TABLE tx_epproducts_domain_model_concept
header_subtitle varchar(255) DEFAULT '' NOT NULL, header_subtitle varchar(255) DEFAULT '' NOT NULL,
teaser_images int(11) unsigned NOT NULL default '0', teaser_images int(11) unsigned NOT NULL default '0',
header_images int(11) unsigned NOT NULL default '0', header_images int(11) unsigned NOT NULL default '0',
images int(11) unsigned NOT NULL default '0',
tstamp int(11) unsigned DEFAULT '0' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL, crdate int(11) unsigned DEFAULT '0' NOT NULL,
@@ -18,6 +18,7 @@
{concept.description -> f:format.html()} {concept.description -> f:format.html()}
</div> </div>
<f:if condition="{teasers}"> <f:if condition="{teasers}">
<f:then>
<a class="anchor" id="teasers"></a> <a class="anchor" id="teasers"></a>
<div class="bg-zinc-50 p-4 mb-4" <div class="bg-zinc-50 p-4 mb-4"
data-controller="teasergrid" data-controller="teasergrid"
@@ -74,12 +75,23 @@
</f:else> </f:else>
</f:if> </f:if>
</div> </div>
</f:then>
<f:else>
<f:if condition="{concept.images -> f:count()} > 0">
<f:render partial="ImageGallery" arguments="{images: concept.images, id: 'concept-{concept.uid}', thumbnails: 1}"/>
</f:if>
</f:else>
</f:if> </f:if>
<f:if condition="{concept.descriptionExtended}"> <f:if condition="{concept.descriptionExtended}">
<div data-rte-content> <div data-rte-content>
{concept.descriptionExtended -> f:format.html()} {concept.descriptionExtended -> f:format.html()}
</div> </div>
</f:if> </f:if>
<f:if condition="{teasers}">
<f:if condition="{concept.images -> f:count()} > 0">
<f:render partial="ImageGallery" arguments="{images: concept.images, id: 'concept-{concept.uid}', thumbnails: 1}"/>
</f:if>
</f:if>
</div> </div>
<div class="col-span-3 lg:col-span-1"> <div class="col-span-3 lg:col-span-1">
<ul class="list-none p-0 m-0 space-y-2"> <ul class="list-none p-0 m-0 space-y-2">