#111352Allow integer columns like pid for foreign_table_item_group
Description
Use case
Records of one kind are often stored in several places that mean something to editors, for example pages of a custom doktype below different parent pages:
Section ├── Category A → pages of the custom doktype ├── Category B → pages of the custom doktype └── Category C → pages of the custom doktype
A content element offers these pages in a selectMultipleSideBySide field (foreign_table => pages, restricted to the doktype). With dozens of items, the list of available items is much easier to use when it is grouped the way editors know it from the page tree: by parent page.
foreign_table_item_group (Feature #95808) looks like the perfect fit: 'foreign_table_item_group' => 'pid', plus itemGroups mapping the parent uids to labels. The same applies to any other integer column that groups records naturally, e.g. a storage folder, a select field stored as integer or sys_language_uid.
Current behaviour
Opening the record fails:
TypeError: TYPO3\CMS\Core\Schema\Struct\SelectItem::__construct(): Argument #5 ($group) must be of type ?string, int given
The database returns pid as integer, AbstractItemProvider::addItemsFromForeignTable() sets it as the item’s group, and SelectItem::fromTcaItemArray() passes it to the constructor unchanged. An itemsProcFunc does not help either, the items are converted to SelectItem before it runs.
This matches the documentation: the group key is defined as string (group (string) in the TCA reference, and the changelog of Feature #95808 says “this needs to be a string”). So this is a feature request rather than a bug. Today it takes a custom itemsProcessor that rebuilds the groups.
Proposal
Accept integer group identifiers by casting them to string, the same way #108989 did for integer labels:
--- a/typo3/sysext/core/Classes/Schema/Struct/SelectItem.php
+++ b/typo3/sysext/core/Classes/Schema/Struct/SelectItem.php
@@ public static function fromTcaItemArray(array $item, string $type = 'select'): SelectItem
{
+ $group = $item['group'] ?? $item[3] ?? null;
return new self(
type: $type,
label: (string)($item['label'] ?? $item[0]),
value: $item['value'] ?? $item[1] ?? null,
icon: $item['icon'] ?? $item[2] ?? null,
- group: $item['group'] ?? $item[3] ?? null,
+ group: $group !== null ? (string)$group : null,
Tested on 14.3.10 with the configuration below: the available items render in one optgroup per parent page, labelled via itemGroups (numeric keys work as they are). The TCA reference of foreign_table_item_group could then state that integer columns are supported.
'related_pages' => [
'label' => 'Pages',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'pages',
'foreign_table_where' => 'AND {#pages}.{#doktype} = 116 AND {#pages}.{#sys_language_uid} IN (0,-1) ORDER BY pages.sorting',
'foreign_table_item_group' => 'pid',
'itemGroups' => [
10 => 'Category A',
11 => 'Category B',
12 => 'Category C',
],
],
],Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[FEATURE] Allow integer columns like pid for foreign_table_item_group Resolves: #111352 Releases: main
Related issues 1
History 3
-
Tim Bäcker changed description <span data-processor="relativetime" data-value="2026-11-05T12:51:59+00:00" > 11/05/26, 12:51 </span>
-
Georg Ringer changed Related to #95808 <span data-processor="relativetime" data-value="2026-11-06T20:38:51+00:00" > 11/06/26, 20:38 </span>
-
Maike Kiebele changed assigned to Maike Kiebele <span data-processor="relativetime" data-value="2026-11-20T15:02:29+00:00" > 11/20/26, 15:02 </span>