Skip to content

Instantly share code, notes, and snippets.

@andyhausmann
Created April 10, 2014 09:08
Show Gist options
  • Save andyhausmann/10359812 to your computer and use it in GitHub Desktop.
Save andyhausmann/10359812 to your computer and use it in GitHub Desktop.
# TYPO3.Neos:SomeTag provides Meta Tag for the Google Webmaster Tools Site Verification
#
prototype(TYPO3.Neos:SomeTage) < prototype(TYPO3.TypoScript:Tag) {
tagName = 'meta'
attributes {
name = 'some-tag-name'
content = ''
}
//@process.1 = ${this.attributes.content != '' ? value : ''}
}
@skurfuerst
Copy link

true, this will not work. though I think it is a good idea.

Example which should work:

# TYPO3.Neos:SomeTag provides Meta Tag for the Google Webmaster Tools Site Verification
#
prototype(TYPO3.Neos:SomeTage) < prototype(TYPO3.TypoScript:Tag) {
    @class = 'My\Package\TypoScript\ConditionalTagImplementation'
    tagName = 'meta'

    attributes {
        name = 'some-tag-name'
        content = ''
    }


}

class ConditionalTagImplementation extends TagImplemenatation {
    public function evaluate() {
        if ($this->tsValue('attributes/content')) {
           return parent::evaluate();
        } else {
           return '';
        }
    }
}

!!!! Currently not public API, so as soon as the "real" solution with @process.1 = ${this.attributes.content != '' ? value : ''} works, this should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment