Liste der Anhänge anzeigen (Anzahl: 2)
Kombination von dependsOn mit Feldtyp group - Problem beim Speichern
Ich hab hier ein eigentlich ganz einfaches Text-Bild-Element, das im Backend folgendermaßen aussieht:
Anhang 27264
Die Gruppe "Text-Bild-Ausrichtung" soll nur dann eingeblendet werden, wenn bei der Bildposition "links vom Text" oder "rechts vom Text" ausgewählt ist. Das funktioniert auch soweit.
Wenn ich aber bei der Bildposition einmal "links/rechts vom Text" ausgewählt habe, kann ich nachher keine andere Position mehr abspeichern. Ich kann zwar eine andere Position auswählen, dann verschwindet die Gruppe "Text-Bild-Ausrichtung" wieder, aber beim Abspeichern wird sie wieder eingeblendet, ebenso meine vorher gewählten Felder.
Wenn ich bei 'gruppe_03' das 'dependsOn' weglasse, kann ich Abspeichern, aber der Text bleibt dann natürlich auch stehen (ohne die Radio-Auswahl-Felder darunter):
Anhang 27265
Die config-Datei sieht so aus:
PHP-Code:
<?php
return array(
'label' => array('Text & Bild', ''),
'types' => array('content'),
'standardFields' => array('headline', 'cssID'),
'wrapper' => array(
'type' => 'single',
),
'fields' => array(
'gruppe_01' => array(
'label' => array('Text', ''),
'inputType' => 'group',
),
'textarea' => array(
'label' => array('Textarea', ''),
'inputType' => 'textarea',
'eval' => array(
'tl_class' => 'clr',
'rte' => 'tinyMCE'
),
),
'gruppe_02' => array(
'label' => array('Bild', ''),
'inputType' => 'group',
),
'image' => array(
'label' => array('Bild', ''),
'inputType' => 'fileTree',
'eval' => array(
'fieldType' => 'radio',
'filesOnly' => true,
'tl_class' => 'w50',
),
),
'image_position' => array(
'label' => array('Bildposition', ''),
'inputType' => 'radio',
'options' => array(
'picture_above' => 'oberhalb vom Text',
'picture_left'=> 'links vom Text',
'picture_right' => 'rechts vom Text',
'picture_below' => 'unterhalb vom Text',
),
'eval' => array(
'tl_class'=>'w50'
),
),
'size' => array(
'label' => array('Bildgröße', 'Wählen Sie die gewünschte Bildgröße aus'),
'inputType' => 'imageSize',
'options' => Contao\System::getContainer()->get('contao.image.sizes')->getAllOptions(),
'reference' => &$GLOBALS['TL_LANG']['MSC'],
'eval' => array(
'tl_class'=>'clr w50',
'rgxp' => 'digit',
'includeBlankOption' => true,
),
),
'gruppe_03' => array(
'dependsOn' => array(
'field' => 'image_position',
'value' => array('picture_left', 'picture_right'),
),
'label' => array('Text-Bild-Ausrichtung', 'Bitte wählen Sie je nach Textmenge/Bildgröße die Ausrichtung zueinander!'),
'inputType' => 'group',
),
'text_alignment' => array(
'dependsOn' => array(
'field' => 'image_position',
'value' => array('picture_left', 'picture_right'),
),
'label' => array('Text-Bild-Ausrichtung', ''),
'inputType' => 'radio',
'options' => array(
'text_start' => 'Text bündig mit Bildoberkante',
'text_center'=> 'Text mittig zum Bild',
'text_end' => 'Text bündig mit Bildunterkante',
'picture_start' => 'Bild bündig mit Textoberkante',
'picture_center'=> 'Bild mittig zum Text',
'picture_end' => 'Bild bündig mit Textunterkante'
),
'eval' => array(
'tl_class'=>'w50'
),
),
),
);
Was muss ich machen, dass die gesamte Gruppe ein- bzw. ausgeblendet, ein Abspeichern bei Änderung der Bildposition aber trotzdem möglich wird?