Bug #29461

Page TSconfig for Extbase flexform values doesn't work

Added by Egbert van der Hout almost 8 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2011-09-03
Due date:
% Done:

100%

TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Description

Works

TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.title = New title
TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.switchableControllerActions.disabled = 1
TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.switchableControllerActions.label = New label
TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.switchableControllerActions.removeItems = Object->View

Doesn't work due to removeDotsFromTS in modifyFlexFormDS (t3lib/tceforms/class.t3lib_tceforms_flexforms.php)

TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.settings.firstsetting.label = New label

Doesn't work due to violation of TS-syntax (duh ;))

TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.switchableControllerActions.addItems.Object->action = Actionname

Problems

  1. Due to the removal of dots in TSconfig Extbase FF-fields (which normally use the format settings.settingsname) those fields cannot be overriden with (Page) TSconfig.
  2. Due to the format of the value field of switchableControllerActions-items (Object->action) no items can be added

Possible solution

Problem 1 (hackish, I know)

- Use special format in TSconfig (_settings_ in stead of settings.):

TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF._settings_firstsetting.label = New label
TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF._settings_firstsetting.removeItems = itemvalueA

- Add this code in t3lib/tceforms/class.t3lib_tceforms_flexforms.php, line 95+ (just after $sheetConf = t3lib_div::removeDotsFromTS(...);)
    // Replace _settings_ by settings. for Extbase Flexforms
    foreach($sheetConf as $sheetName => $sheetArray) {
        foreach($sheetArray as $fieldName => $fieldArray) {
            if (t3lib_div::isFirstPartOfStr($fieldName, '_settings_')) {
                $newFieldName = str_replace('_settings_', 'settings.', $fieldName);
                $sheetConf[$sheetName][$newFieldName] = $fieldArray;
                unset($sheetConf[$sheetName][$fieldName]);
            }
        }
    }

Problem 2 (hackish too)

- Use special format in TSconfig (_Object_Action in stead of Object->):

TCEFORM.tt_content.pi_flexform.myextbaseext_pi.sDEF.switchableControllerActions.addItems._Object_action = Actionname

- Extend the code of solution 1 to ...
    // Replace _settings_ by settings. for Extbase Flexforms
    foreach($sheetConf as $sheetName => $sheetArray) {
        foreach($sheetArray as $fieldName => $fieldArray) {
            if (t3lib_div::isFirstPartOfStr($fieldName, '_settings_')) {
                $newFieldName = str_replace('_settings_', 'settings.', $fieldName);
                $sheetConf[$sheetName][$newFieldName] = $fieldArray;
                unset($sheetConf[$sheetName][$fieldName]);
            } else if ($fieldName === 'switchableControllerActions' && array_key_exists('addItems', $fieldArray)) {
                foreach($fieldArray['addItems'] as $addItemValue => $addItemLabel) {
                    $newAddItemValue = preg_replace('/\_([^\_]*)\_(.*)/', '$1->$2', $addItemValue);
                    $sheetConf[$sheetName][$fieldName]['addItems'][$newAddItemValue] = $addItemLabel;
                    unset($sheetConf[$sheetName][$fieldName]['addItems'][$addItemValue]);
                }
            }
        }
    }

Conclusion

I guess the Extbase FF overrides in TSconfig needs some more thinking to solve permanently.

before.png View (62 KB) Christian Kuhn, 2013-03-25 21:47

after.png View (13.4 KB) Christian Kuhn, 2013-03-25 21:47

typo3-29461-escape_typoscript_key.diff View (6.25 KB) Alexander Stehlik, 2013-07-24 16:35

screenshot_info_tsconfig.png View (4.33 KB) Alexander Stehlik, 2013-11-11 22:36

Screen_Shot_2014-02-24_at_22.50.28.png View - Before and After (32.7 KB) Michiel Roos, 2014-02-24 22:51

Screen_Shot_2014-02-24_at_23.36.49.png View - Before and After patch set 13 (32.9 KB) Michiel Roos, 2014-02-24 23:37

Screen_Shot_2014-02-25_at_08.34.29.png View - Before & After patch set 20 (32.1 KB) Michiel Roos, 2014-02-25 08:35


Related issues

Related to TYPO3 Core - Bug #82372: addItems to flexforms does not work in TYPO3 v8 Rejected 2017-09-08
Duplicated by TYPO3 Core - Feature #50389: Allow escaping of TypoScript keys Closed 2013-07-24

Associated revisions

Revision c9dbea15 (diff)
Added by Kai Vogel over 6 years ago

[BUGFIX] TSConfig for fields with a dot in the name does not work

This patch enables the use of double quotes in TypoScript setup paths.
Thus, for example, can Extbase field names be separated using quotes in
TSConfig.

Example:

TCEFORM.tt_content.pi_flexform.myext_myplugin.sDEF {
"settings.fieldOne".config.type = text
"settings.fieldTwo" = foo
}

Fixes: #29461
Releases: 6.1
Change-Id: Idf30faff9c45c662b2c2f976aeda5cc407e9610a
Reviewed-on: https://review.typo3.org/7711
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Eric Chavaillaz
Tested-by: Eric Chavaillaz
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 6a41c53b (diff)
Added by Christian Kuhn over 6 years ago

Revert "[BUGFIX] TSConfig for fields with a dot in the name does not work"

This reverts commit c9dbea155f3793f7f39d41b5f2bcd92f04443075

The patch seems to break csc styled content in some way,
reverted for now.

Change-Id: I8f7147466ffae727b131143c4d860940a8b6796b
Related: #29461
Reviewed-on: https://review.typo3.org/19282
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 97bb0574 (diff)
Added by Markus Klein over 5 years ago

[FEATURE] Allow escaping of dots in TypoScript key

This patch allows the use of backslashes to escape dots in
TypoScript keys, for example:

my\.escaped\.key = test

will result in a single key "my.escaped.key" with the
value "test".

Additionally it is possible to protect backslashes from beeing
interpreted as escape characters by using double backslashes.

Resolves: #29461
Documentation: #56249
Releases: 6.2
Change-Id: Idcaae75d9a8800134f4a82e0740ddabe35b3df89
Reviewed-on: https://review.typo3.org/19480
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
Reviewed-by: Stefan Neufeind
Reviewed-by: Alexander Stehlik
Tested-by: Alexander Stehlik
Reviewed-by: Markus Klein
Tested-by: Markus Klein

History

#1 Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#2 Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#3 Updated by Gerrit Code Review about 7 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#4 Updated by Gerrit Code Review about 7 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#5 Updated by Gerrit Code Review over 6 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#6 Updated by Gerrit Code Review over 6 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#7 Updated by Gerrit Code Review over 6 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#8 Updated by Gerrit Code Review over 6 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#9 Updated by Gerrit Code Review over 6 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#10 Updated by Gerrit Code Review over 6 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#11 Updated by Gerrit Code Review over 6 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#12 Updated by Gerrit Code Review over 6 years ago

Patch set 12 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#13 Updated by Gerrit Code Review over 6 years ago

Patch set 13 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#14 Updated by Gerrit Code Review over 6 years ago

Patch set 14 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#15 Updated by Gerrit Code Review over 6 years ago

Patch set 15 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#16 Updated by Gerrit Code Review over 6 years ago

Patch set 16 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#17 Updated by Gerrit Code Review over 6 years ago

Patch set 17 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7711

#18 Updated by Gerrit Code Review over 6 years ago

Patch set 18 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/7711

#19 Updated by Kai Vogel over 6 years ago

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

#20 Updated by Christian Kuhn over 6 years ago

  • Status changed from Resolved to New

Had to be reverted again, see my before and after screenshots ... I could send the TS if needed.

#21 Updated by Christian Kuhn over 6 years ago

#22 Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#23 Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#24 Updated by Gerrit Code Review over 6 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#25 Updated by Gerrit Code Review over 6 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#26 Updated by Gerrit Code Review over 6 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#27 Updated by Gerrit Code Review over 6 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#28 Updated by Gerrit Code Review over 6 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#29 Updated by Gerrit Code Review over 6 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#30 Updated by Gerrit Code Review almost 6 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#31 Updated by Chris topher almost 6 years ago

  • Target version set to 6.2.0

#32 Updated by Alexander Stehlik almost 6 years ago

Since I found this issue too late I developed a simpler approach:

I allow the escaping of dots in TypoScript keys:

my\.escapted\.key = test

It is much easier to realize and maybe has less side effects? The required patch is attached.

#33 Updated by Josef F. Glatz (Old User) almost 6 years ago

I think that this function is very important for editors (back-end usability). Any news when this will be fixed?

#34 Updated by Ernesto Baschny almost 6 years ago

  • Category set to TypoScript

#35 Updated by Gerrit Code Review over 5 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19480

#36 Updated by Artus Kolanowski over 5 years ago

I also think that this function is very important for editors. How safe is it, that this is done in 6.2 LTS?

#37 Updated by Artus Kolanowski over 5 years ago

Alexander Stehlik wrote:

Since I found this issue too late I developed a simpler approach:

I allow the escaping of dots in TypoScript keys:

[...]

It is much easier to realize and maybe has less side effects? The required patch is attached.

I've tried your patch with an extension but no success:

TCEFORM.tt_content.pi_flexform.extension_pi1.sDEF.settings\.flexform\.foo\.bar.disabled = 1

Any Idea why?

#38 Updated by Alexander Stehlik over 5 years ago

Hmm, this is strange.

I'm heavily using this setting in a project and it works without problems. Did you use the patch from the review system? The latest patch is containing my version and should work in TYPO3 6.2.

This is an example Page TSConfig configuration I'm using for the news Extension:

TCEFORM {
    tt_content {
        pi_flexform {
            news_pi1 {
                sDEF {
                    settings\.orderBy.disabled = 1
                }
            }
        }
    }
}

The attached screenshot shows how the Info module in the Backend should display the Page TSConfig (with the dot inside the key):

I hope this helps. Otherwise I would need some more information (e.g. some real example code that you are using).

#39 Updated by Gerrit Code Review over 5 years ago

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

#40 Updated by Gerrit Code Review over 5 years ago

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

#41 Updated by Lorenz Ulrich over 5 years ago

See my comment in Gerrit concerning Artus' problem I ran into, too.

#42 Updated by Gerrit Code Review over 5 years ago

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

#43 Updated by Alexander Stehlik over 5 years ago

@Artus: sorry, it seems that the mixed key with escaped and unescaped dots was the problem. I didn't get that. The new patch should fix that issue.

@Lorenz: Thank you for the clarification :)

#44 Updated by Alexander Stehlik over 5 years ago

Thank you all for your feedback (in the review system). I'm answering here because of the better formatting possibilities :)

Of course escaping Backslashes should be possible. The question is: Do we only handle escaped backslashes in front of dots? This would be a bit inconsistent but less code needs to be changed on the user's / integrator's side. E.g. this code works with the current version:

plugin.tx_myext.persistence.classes {
    Tx\MyExt\Domain\Model\Mymodel {
        ...
    }
}

What would happen with the above code? Are the slashes just stripped out because they are not escaped? Or do we leave them untouched (which I would prefer).

The easiest approach would be to just modify two backslashes in front of a dot:

my\.escaped\.key = string

results in

my.escaped.key = string
my\\.escaped\\.key  = string

results in

my\ {
    escaped\ {
        key {
            ...
        }
    }
}

but

My\Slashed\Key = string

will stay as it is:

My\Slashed\Key = string

Would be great to get some thoughts on this.

#45 Updated by Markus Klein over 5 years ago

  • Is Regression set to No

Full Ack! +1

Exactly what I thought. To keep necessary changes as low as possible, only touch backslashes before dots.

To which documentation do he have to add that? Inside TYPO3, TSref??

#46 Updated by Alexander Stehlik over 5 years ago

OK, thank you :) I'll look into it.

What about TypoScript Syntax and In-depth Study for the documentation?

#47 Updated by Gerrit Code Review over 5 years ago

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

#48 Updated by Gerrit Code Review over 5 years ago

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

#49 Updated by Gerrit Code Review over 5 years ago

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

#50 Updated by Gerrit Code Review over 5 years ago

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

#51 Updated by Gerrit Code Review over 5 years ago

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

#52 Updated by Michiel Roos over 5 years ago

Wow, great news!

This patch actually reduces memory usage!

The rest looks pretty grim though.

#53 Updated by Gerrit Code Review over 5 years ago

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

#55 Updated by Gerrit Code Review over 5 years ago

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

#57 Updated by Gerrit Code Review over 5 years ago

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

#58 Updated by Gerrit Code Review over 5 years ago

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

#59 Updated by Gerrit Code Review over 5 years ago

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

#60 Updated by Markus Klein over 5 years ago

  • Status changed from Under Review to Resolved

#61 Updated by Riccardo De Contardi over 1 year ago

  • Status changed from Resolved to Closed

#62 Updated by Georg Ringer 9 months ago

  • Related to Bug #82372: addItems to flexforms does not work in TYPO3 v8 added

Also available in: Atom PDF