From 2f9cecb1b2c1fb71b1c7d91a57ca60267ffcf51a Mon Sep 17 00:00:00 2001
From: Sybille Peters <sypets@gmx.de>
Date: Sun, 12 Nov 2023 13:37:46 +0100
Subject: [PATCH] [TASK] Fix changelog for TCA slug generatorOptions

TCA fields of type 'slug' can be configured with the property
generatorOptions.

Particularly, the short form of using a simple array for
the fields instead of a nested array is a common source
of confusion and the initially introduced changelog had
incorrect examples.

The changelog is improved as follows

- Fix the examples. The examples 2 and 3 showed incorrect
  results
- Use the multidimensional array in the source snippet
- Clarify that ['nav_title', 'title'] is the same as
  [['nav_title'], ['title']], but not the same as
  [['nav_title', 'title']]

Resolves: #89390
Releases: main, 12.4, 11.5
Change-Id: Ib1944c2a1eb9e2a69a0f169f316208cf46f9be84
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81727
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 ...ure-87085-FallbackOptionsForSlugFields.rst | 38 ++++++++++++-------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/typo3/sysext/core/Documentation/Changelog/9.5.x/Feature-87085-FallbackOptionsForSlugFields.rst b/typo3/sysext/core/Documentation/Changelog/9.5.x/Feature-87085-FallbackOptionsForSlugFields.rst
index 0fd9df24b020..e6063d66e822 100644
--- a/typo3/sysext/core/Documentation/Changelog/9.5.x/Feature-87085-FallbackOptionsForSlugFields.rst
+++ b/typo3/sysext/core/Documentation/Changelog/9.5.x/Feature-87085-FallbackOptionsForSlugFields.rst
@@ -18,7 +18,8 @@ configuration as nested array:
       'slug' => [
          'config' => [
             'generatorOptions' => [
-               'fields' => ['nav_title', 'title']
+               // use value of 'nav_title'. If 'nav_title' is empty, use value of 'title'
+               'fields' => [['nav_title', 'title']]
             ]
          ]
       ],
@@ -32,27 +33,36 @@ The fallback field can also be combined with other fields:
       'slug' => [
          'config' => [
             'generatorOptions' => [
+               // Concatenate path segments. In first segment, use 'nav_title' or 'title'.
                'fields' => [['nav_title', 'title'], 'other_field']
             ]
          ]
       ],
    ]
 
+Hint
+----
+
+In this context:
+
+*   :php:`['nav_title', 'title']` is the same as :php:`[['nav_title'], ['title']]`
+*   :php:`['nav_title', 'title']` is **not** the same as :php:`[['nav_title', 'title']]`
+
 Examples
 --------
 
-+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
-| Configuration value                                     | Values of an example page record                                                                                                     | Resulting slug                    |
-+=========================================================+======================================================================================================================================+===================================+
-|:php:`['nav_title', 'title']`                            | :php:`['title' => 'Products', 'nav_title' => '', 'subtitle' => '']`                                                                  | `/products`                       |
-+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
-|:php:`['nav_title', 'title']`                            | :php:`['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => '']`                                                     | `/best-products`                  |
-+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
-|:php:`['subtitle', 'nav_title', 'title']`                | :php:`['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle']`                                     | `/product-subtitle`               |
-+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
-|:php:`['nav_title', 'title'], 'subtitle'`                | :php:`['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle']`                                     | `/best-products/product-subtitle` |
-+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
-|:php:`['seo_title', 'title'], ['nav_title', 'subtitle']` | :php:`['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle', 'seo_title' => 'SEO product title']` | `/seo-product-title/products`     |
-+---------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
++-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
+| Configuration value                                             | Values of an example page record                                                                                                     | Resulting slug                    |
++=================================================================+======================================================================================================================================+===================================+
+|:php:`[['nav_title', 'title']]`                                  | :php:`['title' => 'Products', 'nav_title' => '']`                                                                                    | `/products`                       |
++-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
+|:php:`[['title', 'subtitle']]`                                   | :php:`['title' => 'Products', 'subtitle' => 'Product subtitle']`                                                                     | `/products`                       |
++-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
+|:php:`['title', 'subtitle']` or :php:`[['title'], ['subtitle']]` | :php:`['title' => 'Products', 'subtitle' => 'Product subtitle']`                                                                     | `/products/product-subtitle`      |
++-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
+|:php:`['nav_title', 'title'], 'subtitle'`                        | :php:`['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle']`                                     | `/best-products/product-subtitle` |
++-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
+|:php:`['seo_title', 'title'], ['nav_title', 'subtitle']`         | :php:`['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle', 'seo_title' => 'SEO product title']` | `/seo-product-title/products`     |
++-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------+
 
 .. index:: TCA
-- 
GitLab