Ich würde gerne das Formular erweitern.
Es soll eine extra Checkbox geben und wenn man diese anklickt, soll die Subpalette erscheinen mit dem Texteingabefeld.
Ich habe bisher eine tl_form.php Datei im Ordner contao/dca angelegt und mit Inhalt gefüllt.
Datenbank ist auch aktualisiert und Prod-Cacche gelöscht.
Die Felder tauchen auch im Backend auf - aber halt ohne dieses Subpalette Feature.
Kann mir jemand nen Tipp geben, was ich hier falsch mache?
PHP-Code:
<?php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
/* FORM UM EIN DATENBANK FELD ERWEITERN */
$GLOBALS['TL_DCA']['tl_form']['fields']['sendToExternalUrl'] = [
'label' => ['Formulardaten an eine externe URL senden', ''],
'inputType' => 'checkbox',
'eval' => ['submitOnChange' => true],
'sql' => ['type' => 'boolean', 'default' => false],
];
$GLOBALS['TL_DCA']['tl_form']['fields']['externalUrl'] = [
'label' => ['Externe URL', ''],
'inputType' => 'text',
'eval' => ['tl_class' => 'w50', 'maxlength' => 255, 'mandatory' => true],
'sql' => ['type' => 'string', 'length' => 255, 'default' => ''],
];
//$GLOBALS['TL_DCA']['tl_form']['palettes']['__selector__'] = array('sendToExternalUrl','sendViaEmail', 'storeValues');
//$GLOBALS['TL_DCA']['tl_form']['subpalettes']['sendToExternalUrl'] = array('externalUrl');
PaletteManipulator::create()
->addField('sendToExternalUrl', 'title_legend', PaletteManipulator::POSITION_APPEND)
->addField('externalUrl', 'sendToExternalUrl', PaletteManipulator::POSITION_BEFORE)
->applyToPalette('default', 'tl_form')
;
Lesezeichen