Hallo,
ich habe mir folgende Felder in hinzugefügt:
HTML-Code:
copyright_licence
und
HTML-Code:
copyright_link
Ich habe es in meiner
HTML-Code:
App/Recources/contao/dca/tl_files.php
wie folgt erreicht
PHP-Code:
<?php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$GLOBALS['TL_DCA']['tl_files']['fields']['copyright_licence'] =
[
'label' => ['Copyright-Lizenz', 'Unter welcher Lizenz kann man diese Datei nutzen'],
'inputType' => 'text',
'exclude' => true,
'eval' => array('tl_class' => 'w50'),
'sql' => ['type' => 'string', 'length' => 255, 'default' => ''],
];
$GLOBALS['TL_DCA']['tl_files']['fields']['copyright_link'] =
[
'label' => ['Lizenz-Link', 'Link zur Copyrightlizenz'],
'inputType' => 'text',
'eval' => array('tl_class' => 'w50', 'dcaPicker' => true),
'sql' => ['type' => 'string', 'length' => 255, 'default' => ''],
];
PaletteManipulator::create()
->addField('copyright_licence', PaletteManipulator::POSITION_APPEND)
->addField('copyright_link', PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', 'tl_files')
;
Jetzt versuche ich es, in news_full.html5 mit folgendem Befehl auszugeben.
PHP-Code:
<?php if ($this->copyright_licence || $this->copyright_link): ?>
<?php if ($this->copyright_link): ?>
<a href="<?php echo $this->copyright_link ?>" target="_blank">
<?php endif ?>
<?php echo $this->copyright_licence ?>
<?php if ($this->copyright_link): ?></a><?php endif ?><?php endif ?>
Leider funktioniert es nicht. Muss ich da doch etwas anderes abfragen? Dateien werden generell in Contao mit einer anderen Logik behandelt, daher vermute ich, dass es über einfach nicht geht?
Lesezeichen