Project

General

Profile

Actions

Bug #29461

closed

Page TSconfig for Extbase flexform values doesn't work

Added by Egbert van der Hout about 13 years ago. Updated about 7 years ago.

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

100%

Estimated time:
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.


Files

before.png (62 KB) before.png Christian Kuhn, 2013-03-25 21:47
after.png (13.4 KB) after.png Christian Kuhn, 2013-03-25 21:47
typo3-29461-escape_typoscript_key.diff (6.25 KB) typo3-29461-escape_typoscript_key.diff Alexander Stehlik, 2013-07-24 16:35
screenshot_info_tsconfig.png (4.33 KB) screenshot_info_tsconfig.png Alexander Stehlik, 2013-11-11 22:36
Screen_Shot_2014-02-24_at_22.50.28.png (32.7 KB) Screen_Shot_2014-02-24_at_22.50.28.png Before and After Michiel Roos, 2014-02-24 22:51
Screen_Shot_2014-02-24_at_23.36.49.png (32.9 KB) Screen_Shot_2014-02-24_at_23.36.49.png Before and After patch set 13 Michiel Roos, 2014-02-24 23:37
Screen_Shot_2014-02-25_at_08.34.29.png (32.1 KB) Screen_Shot_2014-02-25_at_08.34.29.png Before & After patch set 20 Michiel Roos, 2014-02-25 08:35

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #82372: addItems to flexforms does not work in TYPO3 v8Rejected2017-09-08

Actions
Has duplicate TYPO3 Core - Feature #50389: Allow escaping of TypoScript keysClosed2013-07-24

Actions
Actions #1

Updated by Gerrit Code Review almost 13 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

Actions #2

Updated by Gerrit Code Review almost 13 years ago

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

Actions #3

Updated by Gerrit Code Review over 12 years ago

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

Actions #4

Updated by Gerrit Code Review over 12 years ago

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

Actions #5

Updated by Gerrit Code Review about 12 years ago

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

Actions #6

Updated by Gerrit Code Review about 12 years ago

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

Actions #7

Updated by Gerrit Code Review about 12 years ago

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

Actions #8

Updated by Gerrit Code Review about 12 years ago

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

Actions #9

Updated by Gerrit Code Review about 12 years ago

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

Actions #10

Updated by Gerrit Code Review about 12 years ago

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

Actions #11

Updated by Gerrit Code Review about 12 years ago

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

Actions #12

Updated by Gerrit Code Review about 12 years ago

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

Actions #13

Updated by Gerrit Code Review almost 12 years ago

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

Actions #14

Updated by Gerrit Code Review almost 12 years ago

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

Actions #15

Updated by Gerrit Code Review almost 12 years ago

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

Actions #16

Updated by Gerrit Code Review almost 12 years ago

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

Actions #17

Updated by Gerrit Code Review almost 12 years ago

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

Actions #18

Updated by Gerrit Code Review over 11 years ago

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

Actions #19

Updated by Kai Vogel over 11 years ago

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

Updated by Christian Kuhn over 11 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.

Actions #22

Updated by Gerrit Code Review over 11 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

Actions #23

Updated by Gerrit Code Review over 11 years ago

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

Actions #24

Updated by Gerrit Code Review over 11 years ago

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

Actions #25

Updated by Gerrit Code Review over 11 years ago

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

Actions #26

Updated by Gerrit Code Review over 11 years ago

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

Actions #27

Updated by Gerrit Code Review over 11 years ago

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

Actions #28

Updated by Gerrit Code Review over 11 years ago

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

Actions #29

Updated by Gerrit Code Review over 11 years ago

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

Actions #30

Updated by Gerrit Code Review over 11 years ago

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

Actions #31

Updated by Chris topher over 11 years ago

  • Target version set to 6.2.0
Actions #32

Updated by Alexander Stehlik over 11 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.

Actions #33

Updated by Josef F. Glatz (Old User) over 11 years ago

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

Actions #34

Updated by Ernesto Baschny about 11 years ago

  • Category set to TypoScript
Actions #35

Updated by Gerrit Code Review about 11 years ago

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

Actions #36

Updated by Artus Kolanowski about 11 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?

Actions #37

Updated by Artus Kolanowski about 11 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?

Actions #38

Updated by Alexander Stehlik about 11 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).

Actions #39

Updated by Gerrit Code Review almost 11 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

Actions #40

Updated by Gerrit Code Review almost 11 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

Actions #41

Updated by Lorenz Ulrich almost 11 years ago

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

Actions #42

Updated by Gerrit Code Review almost 11 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

Actions #43

Updated by Alexander Stehlik almost 11 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 :)

Actions #44

Updated by Alexander Stehlik over 10 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.

Actions #45

Updated by Markus Klein over 10 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??

Actions #46

Updated by Alexander Stehlik over 10 years ago

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

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

Actions #47

Updated by Gerrit Code Review over 10 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

Actions #48

Updated by Gerrit Code Review over 10 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

Actions #49

Updated by Gerrit Code Review over 10 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

Actions #50

Updated by Gerrit Code Review over 10 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

Actions #51

Updated by Gerrit Code Review over 10 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

Actions #52

Updated by Michiel Roos over 10 years ago

Wow, great news!

This patch actually reduces memory usage!

The rest looks pretty grim though.

Actions #53

Updated by Gerrit Code Review over 10 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

Actions #55

Updated by Gerrit Code Review over 10 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

Actions #57

Updated by Gerrit Code Review over 10 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

Actions #58

Updated by Gerrit Code Review over 10 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

Actions #59

Updated by Gerrit Code Review over 10 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

Actions #60

Updated by Markus Klein over 10 years ago

  • Status changed from Under Review to Resolved
Actions #61

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions #62

Updated by Georg Ringer about 6 years ago

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

Also available in: Atom PDF