Ich hab das jetzt so hingekriegt:
Schritt #1
Unter contao/dca/tl_files.php das Lizenz-Feld fürs Backend anlegen:
Code:
<?php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$GLOBALS['TL_DCA']['tl_files']['fields']['license'] = [
'exclude' => true,
'inputType' => 'text',
'eval' =>
[
'maxlength' => 128,
'tl_class' => 'w50'
],
'sql' => "varchar(128) NOT NULL default ''"
];
PaletteManipulator::create()
->addLegend('license_legend', 'meta')
->addField(['license'], 'license_legend')
->applyToPalette('default', 'tl_files')
;
Schritt #2
Unter templates/image.html5 das Feld dann abfragen:
Code:
...
<?php $objFile = \Contao\FilesModel::findByPath($this->singleSRC); ?>
<?php if($objFile->license): ?>
<p class="ce_image__license" ><?= $objFile->license ?></p>
<?php endif; ?>
Vielleicht braucht's ja jemand mal.
Lesezeichen