Bug #73165
closed
Story #69617: FormEngine bugs
TCA Group field filters do not get called for translated items in element browser
Added by Hannes Lau almost 9 years ago.
Updated almost 5 years ago.
Category:
FormEngine aka TCEforms
Description
While trying to add a filter, that allows only default language items to be selected in a TCEform group field, I discovered that the filter methods do not get called for items, that the element browser renders as the translations of default language items.
To reproduce this error, you have to switch on the "Localization view" in the list module.
Due to this bug, it seems impossible to implement a group field filter, that allows only default language items to be selected.
- Description updated (diff)
- Parent task set to #69617
- Subject changed from TCA Group field filters do not get called for translated items to TCA Group field filters do not get called for translated items in element browser
- Status changed from New to In Progress
- Assignee set to Mathias Brodala
- TYPO3 Version changed from 7 to 9
- Status changed from In Progress to Under Review
I would like to test this but I am a bit lost as to what I should test and what should happen before/after the patch. Could you maybe help me out?
Jonas Eberle wrote:
I would like to test this but I am a bit lost as to what I should test and what should happen before/after the patch. Could you maybe help me out?
You'll need a group
field where you can select a translatable table. Then translate a few records. Now the goal is to only allow selection of the default language in that field. You can implement this using a filter for this field, however you won't be able to filter out the translated records. The patch fixes this.
Thank you Mathias, that made me understand it :)
On a side note: is it normal I only get values like that in $parameters['values'] of the filter function?
[
'tt_content_2'
]
And that the filter does not affect the "suggest" browser (/typo3/index.php?route=/ajax/wizard/suggest/search) at all?
I can happily select all elements there, just that they do not get saved then because my filter function does not allow them.
So that 'filter' actually only makes sense with 'hideSuggest'?
Jonas Eberle wrote:
Thank you Mathias, that made me understand it :)
On a side note: is it normal I only get values like that in $parameters['values'] of the filter function?
[...]
You get an array with a values
key which contains record references like this, correct. You can then use e.g. BackendUtility::splitTable_Uid()
and load the records as desired.
And that the filter does not affect the "suggest" browser (/typo3/index.php?route=/ajax/wizard/suggest/search) at all?
I can happily select all elements there, just that they do not get saved then because my filter function does not allow them.
So that 'filter' actually only makes sense with 'hideSuggest'?
Well I guess the suggest wizard is another place which needs to be fixed then.
Here's how I tested:
- Create a multilingual site
- Add a filter function https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Group.html to a 'group' field from EXT:styleguide
I used Configuration/TCA/tx_styleguide_elements_group.php and adapted the first field:
'group_db_1' => [
'config' => [
'filter' => [
[
'userFunc' => 'myFilterFunc',
],
...
- add the filter function somewhere (e.g. to AdditionalConfiguration.php)
function myFilterFunc(array $parameters, $parentObject) {
$l = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(\TYPO3\CMS\Core\Log\LogManager::class /* nvm, we just need a class here with configured logger */ );
$l->critical('myFilterFunc', $parameters);
$fieldValues = $parameters['values'];
return $fieldValues;
}
- add some "Form engine elements - group" elements and translate some
- look in the log or use xdebug to find method calls
- to be continued... don't have time right now
7. The filter function gets called when you open the record selector on the field you edited
8. The filter function gets only called for standard language records - making it impossible to filter other languages.
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF