Bug #86979

stdWrap fieldRequired/insertData sometimes not working as expected since TYPO3 9 LTS

Added by Josef Glatz 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2018-11-22
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Problem/Description

The following TypoScript snippet works with TYPO3 8 LTS:

page {
    bodyTagCObject = COA
    bodyTagCObject {
        stdWrap.wrap = <body id="top"|>

        # attribute class
        10 = COA
        10 {
            stdWrap {
                noTrimWrap = | class="|"|
                required = 1
            }

            # Add current language
            20 = TEXT
            20 {
                value = language-{TSFE:sys_language_uid} languagecontent-{TSFE:sys_language_content}
                insertData = 1
                noTrimWrap = || |
            }

            # Add level
            25 = TEXT
            25 {
                value = level-{level:0}
                insertData = 1
                noTrimWrap = || |
            }

            # Add uid of optional FE-layout
            40 = TEXT
            40 {
                fieldRequired = layout
                value = layout-{field:layout}
                insertData = 1
                noTrimWrap = | ||
            }

            # Add uid of rootpage
            50 = TEXT
            50 {
                value = root-{leveluid:0}
                insertData = 1
                noTrimWrap = | ||
            }

            # Add class if it's the rootpage
            60 = TEXT
            60 {
                fieldRequired = is_siteroot
                value = rootpage
                noTrimWrap = | ||
            }
        }

        # attribute(s) data-*
        20 = COA
        20 {
            # Add page UID
            10 = TEXT
            10 {
                value = data-page-uid="{field:uid}" 
                insertData = 1
                noTrimWrap = | ||
            }
        }
    }
}

Link to the working code snippet of my TYPO3 Distribution
__

The following objects does not appear anymore when it should apply on a proper page:

page.bodyTagCObject.10.60 does not render anything
            # Add class if it's the rootpage
            60 = TEXT
            60 {
                fieldRequired = is_siteroot
                value = rootpage
                noTrimWrap = | ||
            }

It seems like the page field is_siteroot isn't true. But it works when rendering the value, and it shows 1 on the root page. So fieldRequired get's not "true"

  • instead of rootpage
  • nothing is rendered/returned by this object
page.bodyTagCObject.20.10 does not render {field:uid}
            # Add page UID
            10 = TEXT
            10 {
                value = data-page-uid="{field:uid}" 
                insertData = 1
                noTrimWrap = | ||
            }
  • instead of data-page-uid="1"
  • only data-page-uid="" is rendered

Just to re-check: the following snippet is working fine on the same page

page {
4 = TEXT
    4 {
        field = is_siteroot
        fieldRequired = is_siteroot
        wrap = <h1>|</h1>
    }
    5 = TEXT
    5 {
        field = uid
        wrap = <h2>|</h2>
    }
}

Acceptance Criteria

  • Such a straight forward TypoScript setup must work, as there should be no breaking changes in this area after upgrading to TYPO3 9 LTS.

Related issues

Related to TYPO3 Core - Bug #87186: Missing namespace for TypoScriptFrontendController in CObjectViewHelper Closed 2018-12-17
Related to TYPO3 Core - Bug #86703: Page's data partly not available via getText if page has form CE Closed 2018-10-20
Duplicated by TYPO3 Core - Bug #87003: Plugins overrides Page Data Closed 2018-11-26

Associated revisions

Revision aad4efd3 (diff)
Added by Thorben Nissen 10 months ago

[BUGFIX] Avoid overwriting page context in TSFE->cObj by f:cObject

Change `CObjectViewHelper::getContentObjectRenderer` to return a new
instance of `ContentObjectRenderer` instead of returning a reference to
`TSFE->cObj`.

Change unit test and add prepared instance of `ContentObjectRenderer`
to `GeneralUtility` via `addInstance` method.

Resolves: #86979
Releases: master
Change-Id: Ibdb8fd1d974a525f3583929a743447a8650ca1ab
Reviewed-on: https://review.typo3.org/58661
Tested-by: TYPO3com <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Josef Glatz 10 months ago

  • Description updated (diff)

#2 Updated by Stephan grass 10 months ago

Maybe the same issue here:

page.bodyTagCObject = COA
page.bodyTagCObject {
    5 = TEXT
    5 {
        field = uid
        noTrimWrap = | id="page_|" |
    }
    stdWrap.wrap = <body|>
}

will result in

<body id="page_">

#3 Updated by Josef Glatz 10 months ago

  • Related to Bug #76489: f:cObject resets other global parameters in fluid_styled_content added

#4 Updated by Josef Glatz 10 months ago

If the problem occurs, the row of the page seems not to be available anymore in specific areas within TypoScript.

For me, https://review.typo3.org/#/c/58661/ basically fixes the issue. Although that may be correct, I do not know if there are any other crucial areas that will fail.

A partially workaround is to use {TSFE:id} instead of {field:uid} for example. But that's really just an temporary workaround

#5 Updated by Josef Glatz 10 months ago

  • Status changed from New to Accepted

#6 Updated by Gerrit Code Review 10 months ago

  • Status changed from Accepted to Under Review

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

#7 Updated by Gerrit Code Review 10 months ago

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

#8 Updated by Helmut Hummel 10 months ago

  • Duplicated by Bug #87003: Plugins overrides Page Data added

#9 Updated by Helmut Hummel 10 months ago

  • Related to deleted (Bug #76489: f:cObject resets other global parameters in fluid_styled_content)

#10 Updated by Gerrit Code Review 10 months ago

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

#11 Updated by Thorben Nissen 10 months ago

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

#12 Updated by Markus Klein 9 months ago

  • Related to Bug #87186: Missing namespace for TypoScriptFrontendController in CObjectViewHelper added

#13 Updated by Riccardo De Contardi 8 months ago

  • Related to Bug #86703: Page's data partly not available via getText if page has form CE added

#14 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF