From 38063d6e38e6c2a16cee6056b7d0a9665199cb31 Mon Sep 17 00:00:00 2001
From: Henrik Elsner <noreply@example.com>
Date: Thu, 14 Dec 2023 12:46:08 +0000
Subject: [PATCH] [DOCS] Prevent PHP 8.1 issues for formValues usage

Resolves: #102669
Resolves: #101768
Releases: main, 12.4
Change-Id: Ie377f122cfc9acba74c1684f68bb4e3434bf12d0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82128
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
---
 .../form/Documentation/I/Concepts/Variants/Index.rst | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/form/Documentation/I/Concepts/Variants/Index.rst b/typo3/sysext/form/Documentation/I/Concepts/Variants/Index.rst
index 4e659ab5fd7f..e7e8fc494094 100644
--- a/typo3/sysext/form/Documentation/I/Concepts/Variants/Index.rst
+++ b/typo3/sysext/form/Documentation/I/Concepts/Variants/Index.rst
@@ -94,7 +94,7 @@ incomplete - example:
    variants:
      -
        identifier: variant-1
-       condition: 'formValues["checkbox-1"] == 1'
+       condition: 'traverse(formValues, "checkbox-1") == 1'
        # If the condition matches, the label property of the form
        # element is set to the value 'Bar'
        label: Bar
@@ -164,7 +164,7 @@ current renderable without having to duplicate it.
 
 For example:
 
-:yaml:`formValues[renderable.getIdentifier()] == "special value"`.
+:yaml:`traverse(formValues, renderable.getIdentifier()) == "special value"`.
 
 
 ``formValues`` (array)
@@ -175,7 +175,7 @@ key within this array represents a form element identifier.
 
 For example:
 
-:yaml:`formValues["text-1"] == "yes"`.
+:yaml:`traverse(formValues, "text-1") == "yes"`.
 
 
 ``stepIdentifier`` (string)
@@ -260,7 +260,7 @@ Create a variant with conditions through the PHP API::
    /** @var TYPO3\CMS\Form\Domain\Model\Renderable\RenderableVariantInterface $variant */
    $variant = $formElement->createVariant([
        'identifier' => 'variant-1',
-       'condition' => 'formValues["checkbox-1"] == 1',
+       'condition' => 'traverse(formValues, "checkbox-1") == 1',
        'label' => 'foo',
    ]);
 
@@ -371,7 +371,7 @@ In this example a bunch of validators are added to the field
            variants:
              -
                identifier: validation-1
-               condition: 'formValues["checkbox-1"] == 1'
+               condition: 'traverse(formValues, "checkbox-1") == 1'
                properties:
                  fluidAdditionalAttributes:
                    required: required
@@ -509,7 +509,7 @@ In this example the second step :yaml:`page-2` is disabled if the field
        variants:
          -
            identifier: variant-2
-           condition: 'formValues["checkbox-1"] == 1'
+           condition: 'traverse(formValues, "checkbox-1") == 1'
            renderingOptions:
              enabled: false
        renderables:
-- 
GitLab