madeyourday/contao-rocksolid-custom-elements

The subpalette toggler cannot be saved

qzminski opened this issue · 2 comments

I have a gallery custom content element that has a dropdown field where you can select whether the source would be:

  1. a folder (option folder) – the file picker appears;
  2. a list of images (option manual) – RSCE list with custom fields.

These are the workflow steps to reproduce:

  1. Create a new element.
  2. The folder option is selected.
  3. Choose the manual option and save the record.
  4. Choose the folder option back and save the record – this does not work, the field is not updated and manual option remains.

If the record is saved with a certain dropdown option (i.e. manual) that toggles the RSCE list with custom fields, then you can no longer choose and save any other option (i.e. folder).

It seems that it used to work, but I don't know which versions could change the behavior.

<?php
return [
    'label' => ['Gallery'],
    'types' => ['content'],
    'contentCategory' => 'media',
    'standardFields' => ['headline', 'cssID'],
    'fields' => [
        'sourceType' => [
            'label' => [
                'en' => ['Source type', 'Here you can choose the source type.'],
            ],
            'inputType' => 'select',
            'options' => [
                'folder' => 'Folder selection',
                'manual' => 'Manual selection',
            ],
        ],
        'sourceFolder' => [
            'label' => ['Images source folder', 'Please choose the images source folder.'],
            'inputType' => 'fileTree',
            'eval' => ['fieldType' => 'radio', 'tl_class' => 'clr'],
            'dependsOn' => ['field' => 'sourceType', 'value' => 'folder'],
        ],
        'images' => [
            'dependsOn' => ['field' => 'sourceType', 'value' => 'manual'],
            'label' => [
                'en' => ['Images'],
            ],
            'elementLabel' => [
                'en' => '%s. Image',
            ],
            'inputType' => 'list',
            'fields' => [
                'image_url' => [
                    'label' => [
                        'en' => ['Image url', 'Please enter the image URL.'],
                    ],
                    'inputType' => 'text',
                    'eval' => ['tl_class' => 'clr'],
                ],
            ],
        ],
    ],
];
ausi commented

Should be fixed now in version 2.4.2.

Works like a charm! Thank you!