From e8e2d4094868f000c9638ba337bf85e89240a89d Mon Sep 17 00:00:00 2001 From: Christopher Hlubek Date: Mon, 13 Jul 2015 16:53:48 +0200 Subject: [PATCH] [FEATURE] Make Shariff tag attributes extensible This change uses a `Tag` object as the base for the Shariff object. All attributes can be overriden and extended using TypoScript. --- .../Private/Templates/NodeTypes/Shariff.html | 1 - Resources/Private/TypoScript/Root.ts2 | 30 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) delete mode 100644 Resources/Private/Templates/NodeTypes/Shariff.html diff --git a/Resources/Private/Templates/NodeTypes/Shariff.html b/Resources/Private/Templates/NodeTypes/Shariff.html deleted file mode 100644 index b347fab..0000000 --- a/Resources/Private/Templates/NodeTypes/Shariff.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/Resources/Private/TypoScript/Root.ts2 b/Resources/Private/TypoScript/Root.ts2 index 1a4cc3f..781854b 100644 --- a/Resources/Private/TypoScript/Root.ts2 +++ b/Resources/Private/TypoScript/Root.ts2 @@ -23,9 +23,35 @@ prototype(TYPO3.Neos:Page) { } } -prototype(Networkteam.Neos.Shariff:Shariff) { - services = ${'"' + String.toLowerCase(Array.join(Configuration.setting('Networkteam.Neos.Shariff.options.services'),'","')) + '"'} +prototype(Networkteam.Neos.Shariff:Shariff) < prototype(TYPO3.TypoScript:Tag) { + // API + services = ${Configuration.setting('Networkteam.Neos.Shariff.options.services')} theme = ${Configuration.setting('Networkteam.Neos.Shariff.frontend.theme')} orientation = ${Configuration.setting('Networkteam.Neos.Shariff.frontend.orientation')} language = ${Configuration.setting('Networkteam.Neos.Shariff.frontend.language')} + + attributes { + class = 'shariff' + data-backend-url = TYPO3.TypoScript:UriBuilder { + package = 'Networkteam.Neos.Shariff' + format = 'json' + controller = 'Shariff' + action = 'counts' + } + data-services = ${String.toLowerCase(Json.stringify(services))} + data-theme = ${theme} + data-orientation = ${orientation} + data-lang = ${language} + + // Put additional attributes here, see https://github.com/heiseonline/shariff#options-data-attributes + } + + // Internal + @override.services = ${this.services} + @override.theme = ${this.theme} + @override.orientation = ${this.orientation} + @override.language = ${this.language} + + @process.contentElementWrapping = TYPO3.Neos:ContentElementWrapping + @exceptionHandler = 'TYPO3\\Neos\\TypoScript\\ExceptionHandlers\\NodeWrappingHandler' } \ No newline at end of file