johannessteu / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
GNU General Public License v3.0
0 stars 0 forks source link

Typoscript variables no being reset when using ">" #1040

Closed johannessteu closed 8 years ago

johannessteu commented 8 years ago

Jira issue originally created by user sorenmalling:

Case Trying to implement my own way of rendering the /page path, I get the **toString printed in the top of the page of the assigned ${node} and ${site} from the origin Page.ts file, located in the TYPO3.Neos package even when resetting the body

How to reproduce

prototype(Murtag.Site:Parts.Header) < prototype(TYPO3.TypoScript:Tag) {
    tagName = 'header'
    content = TYPO3.TypoScript:Array {
        logo = TYPO3.TypoScript:Tag {
            tagName = 'h1'
            content = 'Mur- og tagprodukter'
        }
        navigation = TYPO3.Neos:Menu {
            itemCollection = ${q(site).children('[instanceof TYPO3.Neos:Document]').get()}
        }
    }
}

prototype(Murtag.Site:Parts.Footer) < prototype(TYPO3.TypoScript:Tag) {
    tagName = 'footer'
    content = TYPO3.TypoScript:Array {
        logo = 'Logo'
        navigation = 'navigation'
    }
}

prototype(Murtag.Site:Page) < prototype(TYPO3.Neos:Page) {
    body = TYPO3.TypoScript:Array {
        header = Murtag.Site:Parts.Header

        sitename = TYPO3.TypoScript:Tag {
            tagName = 'h1'
            content = ${q(documentNode).property('title')}
        }

        main = TYPO3.Neos:PrimaryContent {
            nodePath = 'main'
        }

        footer = Murtag.Site:Parts.Footer

    }
}

page = TYPO3.TypoScript:Case {
    default {
        condition = TRUE
        renderer = Murtag.Site:Page
    }
}

The above prints the node and site (with **toString) - expected, as Array renders all assigned properties.

Adding "body >" to remove the original assigned object (Template) from TYPO3.Neos Page.ts document - expected was that all assigned properties was removed. Reality is, that node and site is still present and being printed.

The expected typoscript, that should remove the printed node and site is the following

prototype(Murtag.Site:Parts.Header) < prototype(TYPO3.TypoScript:Tag) {
    tagName = 'header'
    content = TYPO3.TypoScript:Array {
        logo = TYPO3.TypoScript:Tag {
            tagName = 'h1'
            content = 'Mur- og tagprodukter'
        }
        navigation = TYPO3.Neos:Menu {
            itemCollection = ${q(site).children('[instanceof TYPO3.Neos:Document]').get()}
        }
    }
}

prototype(Murtag.Site:Parts.Footer) < prototype(TYPO3.TypoScript:Tag) {
    tagName = 'footer'
    content = TYPO3.TypoScript:Array {
        logo = 'Logo'
        navigation = 'navigation'
    }
}

prototype(Murtag.Site:Page) < prototype(TYPO3.Neos:Page) {
    body >
    body = TYPO3.TypoScript:Array {
        header = Murtag.Site:Parts.Header

        sitename = TYPO3.TypoScript:Tag {
            tagName = 'h1'
            content = ${q(documentNode).property('title')}
        }

        main = TYPO3.Neos:PrimaryContent {
            nodePath = 'main'
        }

        footer = Murtag.Site:Parts.Footer

    }
}

page = TYPO3.TypoScript:Case {
    default {
        condition = TRUE
        renderer = Murtag.Site:Page
    }
}

Not untill I add ex "node >" to the body part, the node and site is rendered

Jira-URL: https://jira.neos.io/browse/NEOS-1821

johannessteu commented 8 years ago

Comment created by @aertmann:

[~sorenmalling]: Hey thanks for reporting. I've noticed a similar issue lately where processors weren't unset

@if.notEmpty >
johannessteu commented 8 years ago

Comment created by sorenmalling:

I can confirm that this issue stil exists in 2.2.3

Simple TS2 to test

page = Page {
    body >
    body = TYPO3.TypoScript:Array {
        content {
            // The default content section
            main = PrimaryContent {
                nodePath = 'main'
            }
        }
    }

will ouput the "_toString" part of the node. What part of the rendering/TS parsing should this be debugged in? I will happily start, as I'm not using the default Page object and will have this issue forever, if I dont get it fixed :-)

johannessteu commented 8 years ago

Comment created by @aertmann:

not sure, maybe [sebastian] or [christopher] can help?

johannessteu commented 8 years ago

Comment created by @hlubek:

Hi [~sorenmalling],

if you could provide a test case like the ones in Packages/Neos/TYPO3.TypoScript/Tests/Functional/TypoScriptObjects it would be easier to test the expected behavior.

The problem itself should be somewhere in the Parser class since that one builds the prototype hierarchy. If you dump the object tree (around Packages/Neos/TYPO3.TypoScript/Classes/TYPO3/TypoScript/Core/Parser.php:284) it should be visible that an unwanted definition is left on the page path.

johannessteu commented 8 years ago

Comment created by sorenmalling:

[~christopher]

Thanks, I created a simple PR with the similar concept as above

https://github.com/sorenmalling/neos-development-collection/commit/63a85be962e5f517dddd6382cabca82f12e3c067

I think I will have to create a more advance example in the TYPO3.Neos package, to be able to use the "Page" prototype. Will look into that later this weekend.

I will debug the parser afterwards