typo3typoscript

TypoScript's stdWrap.replacement does not replace in combination with insertData


What is missing, when trying to replace an inserted string using TypoScript?

10 = TEXT
10 {
    value = {path: EXT:myext/Resources/Public/index.html}
    insertData = 1
    stdWrap.replacement.10 {
        search = index.html
        replace = 
    }
}

While this is working as expected.

10 = TEXT
10 {
    value = _assets/6a1e8e40c488756fd82fc9331ca8b24f/index.html
    stdWrap.replacement.10 {
        search = index.html
        replace = 
    }
}

Solution

  • stdWrap functions are always executed in a specific order, which is listed in the TypoScript reference.

    https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Stdwrap.html#content-supplying-properties-of-stdwrap

    Since insertData is executed after stdWrap, there would be a replacement first, which obviously can't find anything and after that the insertData will be executed.

    Since additionally the TEXT-cObject supports stdWrap directly on the root level and there is a data property too, you should change your code like this:

    10 = TEXT
    10 {
        data = path: EXT:myext/Resources/Public/index.html
        replacement.10 {
            search = index.html
            replace = 
        }
    }