Review main Merged

72056[TASK] Simplify checkbox items TCA

Nikita Hovratov CR +2 V +2 Hard +35 −294 updated 11/10/21, 09:13

Commit message

TCA shares same keys across different types,
and so does "items" with type check, radio
and select. The value is usually set for the
array key "1". But type check is special in
that regard: the value is stored as a bitset.
This means, the value is completely unused
and shall not be provided for checkboxes.

1. All occurrences of "items => ['1' => '']"
   removed.

2. When checkboxes only have 1 item and no
   configuration whatsoever, "items" can be
   omitted. These constructs are gone now:

   'items' => [
       [
            0 => '',
            1 => '',
       ],
    ]

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benni Mack +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 29

Show 9 more files

Review log 78

  1. Nikita Hovratov uploaded patch set 1 11/04/21, 19:51

  2. core-ci voted on patch set 1 V +1 11/04/21, 20:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18917

  3. Benni Mack voted on patch set 1 CR +1 11/05/21, 12:01

  4. Christian Kuhn voted on patch set 1 V +1 CR +1 11/09/21, 17:37

  5. Oli Bartsch commented on patch set 1 11/09/21, 18:07

    I really like this simplification. However, in case I want to add configuration to an item, I still have to add superfluous array keys / values. Given following config: 'config' => [ 'type' => 'check', 'renderType' => 'checkboxToggle', 'items' => [ [ 'invertStateDisplay' => true, ], ], ], This will lead to "Item 0 of field my_field of TCA my_table has no label" exception. It therefore requires to add the key 0 with at least an empty string. 'config' => [ 'type' => 'check', 'renderType' => 'checkboxToggle', 'items' => [ [ 0 => '', 'invertStateDisplay' => true, ], ], ], Do we want to tackle this here, too?
  6. Nikita Hovratov commented on patch set 1 11/09/21, 18:17

    Reply

    Yes you're right. I would say we tackle it in another patch. This is just cleanup, which adds no functionality. Probably something for v12.
  7. Benni Mack voted on patch set 1 V +2 CR +2 11/10/21, 09:13

  8. Benni Mack merged patch set 2 11/10/21, 09:13