Project

General

Profile

Actions

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 about 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2016-02-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by Mathias Schreiber about 8 years ago

  • Description updated (diff)
  • Parent task set to #69617
Actions #2

Updated by Mathias Brodala over 5 years ago

  • 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
Actions #3

Updated by Gerrit Code Review over 5 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58888

Actions #4

Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58888

Actions #5

Updated by Jonas Eberle over 4 years ago

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?

Actions #6

Updated by Mathias Brodala over 4 years ago

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.

Actions #7

Updated by Jonas Eberle over 4 years ago

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'?

Actions #8

Updated by Mathias Brodala over 4 years ago

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.

Actions #9

Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/58888

Actions #10

Updated by Jonas Eberle over 4 years ago

Here's how I tested:

  1. Create a multilingual site
  2. 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',
                    ],    
      ...
      
  3. 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;
    }
    
  4. add some "Form engine elements - group" elements and translate some
  5. look in the log or use xdebug to find method calls
  6. to be continued... don't have time right now
Actions #11

Updated by Jonas Eberle over 4 years ago

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.

Actions #12

Updated by Gerrit Code Review over 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61602

Actions #13

Updated by Mathias Brodala over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #14

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF