Nachtrag: war nicht ganz einfach, aber ich habs hinbekommen
Ganz herzlichen Dank an Spooky für die neue Dokumentation!!!
templates/gallery_single_image_flex.html5:
HTML-Code:
<div class="gallery_flex_container">
<div class="gallery_flex_part_left">
<ul class="cols_<?= $this->perRow ?>" itemscope itemtype="http://schema.org/ImageGallery">
<?php $count = 0; foreach ($this->body as $class => $row): ?>
<?php foreach ($row as $col): ?>
<?php if ($count == 0): ?>
<?php if ($col->addImage): ?>
<li class="<?= $class ?> <?= $col->class ?>">
<figure class="image_container"<?php if ($col->margin): ?> style="<?= $col->margin ?>"<?php endif; ?>>
<?php if ($col->href): ?>
<a href="<?= $col->href ?>"<?= $col->attributes ?> title="<?= $this->headline ?>" alt="<?= $col->alt ?>"<?php $this->insert('picture_default', $col->picture); ?></a>
<?php endif; ?>
</figure>
</li>
<?php endif; ?>
<?php else: ?>
<?php if ($col->addImage): ?>
<li class="<?= $class ?> <?= $col->class ?>" style="display:none;">
<figure class="image_container"<?php if ($col->margin): ?> style="<?= $col->margin ?>"<?php endif; ?>>
<?php if ($col->href): ?>
<a href="<?= $col->href ?>"<?= $col->attributes ?><?php if ($col->linkTitle): ?> title="<?= $col->linkTitle ?>" alt="<?= $col->alt ?>"<?php endif; ?>><?php $this->insert('picture_default', $col->picture); ?></a>
<?php endif; ?>
</figure>
</li>
<?php endif; ?>
<?php endif; ?>
<?php $count++; endforeach; ?>
<?php endforeach; ?>
</ul>
</div>
<div class="gallery_flex_part_right">
<h2><?= $this->headline ?></h2>
<!-- <a href="<?= $col->href ?>"<?= $col->attributes ?> title="<?= $this->headline ?>" alt="<?= $col->alt ?>"><h2><?= $this->headline ?></h2></a> -->
<p><?= $this->galry_txt ?></p>
<p class="info"><?= $count; ?> <?php if ($count == 0): ?> Bild <?php else: ?> Bilder <?php endif; ?></p>
</div>
</div>
files/layout/css/gallery_single_image_flex.css:
Code:
/* Bildergalerie ein Vorschaubild in Flexbox */
.ce_gallery.block > h2 {
display: none;
}
.gallery_flex_container {
display: flex;
flex-wrap: nowrap;
flex-direction: row;
justify-content: flex-start;
}
.gallery_flex_container > div {
flex: 0 50%;
}
.gallery_flex_part_left li {
list-style-type: none;
}
.gallery_flex_part_left {
align-self: center;
}
.gallery_flex_part_right {
align-self: flex-start;
}
contao/dca/tl_content.php:
PHP-Code:
<?php
// Galerie Feld zur Beschreibung vom Album
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$GLOBALS['TL_DCA']['tl_content']['fields']['galry_txt'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['galry_txt'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('maxlength'=>255, 'tl_class'=>'w50'),
'sql' => "varchar(255) NOT NULL default ''",
];
PaletteManipulator::create()
->addLegend('galry_txt', 'headline', PaletteManipulator::POSITION_AFTER)
->addField('galry_txt', 'headline', PaletteManipulator::POSITION_AFTER)
->applyToPalette('gallery', 'tl_content')
;
contao/languages/de/tl_content.php:
PHP-Code:
<?php
// Galerie Feld zur Beschreibung vom Album
$GLOBALS['TL_LANG']['tl_content']['galry_txt'] = ['Beschreibung','Hier können Sie dem Inhaltselement eine Beschreibung hinzufügen.'];
Ergebnis:
Unbenannt.PNG
Das man natürlich nach Leeren des Caches auch noch das Installtool aufrufen sollte, wurde mir dann auch irgendwann mal bewusst...
Kleine Kosmetik am Rande wird noch passieren müssen: die Überschrift möchte genauso klickbar sein, wie das Bild auch und die Links sollten dann gleich sein.
Zudem stimmt die Anzahl der Bilder, aber zur Lightbox etc übergibt er eins weiter?!?
ToM
Lesezeichen