Skip to content

Question: How to use Variants inside a Repeatable Container #55

@Denneee

Description

@Denneee

Hi,
i use your extension to create a repeatable container with positions that can be added.
Im creating the form programaticly.
I have now struggles to make variants inside this containers work.

Till now i tried this:

$repeater = $positions->createElement('positions', 'RepeatableContainer');
$packagingTypes = $repeater->createElement('packaging_type', 'RadioButton');
$packagingTypes->setProperty('options', $packagingData);

$containerType = $repeater->createElement('container_type', 'Text');
$containerType->createVariant([
                'identifier' => 'variant' ,
                'condition' => 'formValues && formValues["positions"] && formValues["positions"][0]["packaging_type"] == 3'  ,
                'validators' => [
                    [
                        'identifier' => 'NotEmpty'
                    ]
                ]
            ]);

But the Variant is only working on the first element not on the coppied elements.

I also tried traverse(formValues, "positions.0.packaging_type"), but that was not working at all.

Would be great full for any idea!

Typo3: v13.4.27
Extension: 5.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions