Project

General

Profile

Actions

Bug #96461

open

itemsProcFunc is not able to add itemGroups

Added by Philipp Wrann over 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2022-01-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Before itemGroups was introduced, it was possible to add a ['Some Label', '--div--'] option to add grouped items from itemsProcFunc. This is not fully supported anymore because you dont have access to the itemGroups configuration.

You can still add groups but have no possibility of adding labels.

Lets assume you have an "itemsProcFunc" method which takes one parameter called $config:

1) You cant manipulate $config['itemGroups'] because ItemProcessingService has no support for it
2) You can not manipulate $config['config']['itemGroups'] because it is not passed as reference
3) You can not use ExtensionManagementUtility::addTcaSelectItemGroup, it modifies the TCA as expected but TcaSelectItems::addData already works with a local copy of the field config

Current possible workarounds:

1) keep using ['LLL:label', '--div--']

con: will be deprecated, no future-proof solution

2) Dont use 'LLL:label' for the itemGroup Key, use the translated label

con: Does not "feel" right/consistant but works

3) Add the itemGroup via TCA Overrides

con: not as much straight-forward as it could be, more boilerplate code...

Possible solution:

A) pass the global TCA-config value to TcaSelectItems::groupAndSortItems

pro: Could alter itemGroups via ExtensionManagementUtility::addTcaSelectItemGroup
con: unpredictable side-effects possible

B) pass whole field config as reference

pretty much the same cons than A but the Utility method ExtensionManagementUtility::addTcaSelectItemGroup would not work

C) add itemGroups, sortItems and everything necessary to $processorParameters in AbstractItemProvider::resolveItemProcessorFunction

pro: you can alter itemGroups without any side-effects
con: The Utility method ExtensionManagementUtility::addTcaSelectItemGroup would not work

I would suggest Option C as a solution because it does only add some new options without changing anything else.

No data to display

Actions

Also available in: Atom PDF