Feature #29423
closedAdd "if" function to includeCSS and includeJS TS object
100%
Description
Wouldn't it be nice to have the possibility to include a css or javascript depending on a constant?
Example:
page.includeCSS {
colorbox = {$plugin.rzcolorbox.cssPath}
colorbox.if.isTrue = {$plugin.rzcolorbox.cssPath}
colorbox.if.ifFalse = {$plugin.rzcolorbox.deactivate}
}
Usefull also for:
includeLibs
includeJS
includeJSFooter
Updated by Andreas Wolf about 13 years ago
- Category set to TypoScript
- Complexity set to easy
Updated by Jo Hasenau about 13 years ago
This is already possible and IMHO it's easier than the proposed solution:
Use this TS-Setup
page.includeCSS { {$plugin.rzcolorbox.cssPath} }
and these TS-constants for
the active cssPath
plugin.rzcolorbox.cssPath = colorbox = my/path/to/the.css
the inactive cssPath
plugin.rzcolorbox.cssPath = #
You can even use the constant editor to make it available via check box or selector box.
Not tested though ...
Updated by Jo Hasenau about 13 years ago
And of course you can deactivate the value depending on another constant the same ways as in the first example.
Setup:
page.includeCSS { {$plugin.rzcolorbox.deactivate}{$plugin.rzcolorbox.cssPath} }
Constants for active state:
plugin.rzcolorbox { cssPath = colorbox = my/path/to/the.css deactivate = }
Now you can add a single line to the constants to deactivate the whole line on any desired page:
plugin.rzcolorbox.deactivate = #
Can be configured to make use of the constant editor as well.
Updated by Alexander Grein about 13 years ago
Hi Jo,
doing this, it is not possible to use the constant editor type=file parameter anymore.
Also a checkbox (type=boolean) for disabling is not possible.
Using a constant inside the if-function should only be an example.
If the objects get a "real" if-function, include stdWrap functionality, this would open up a lot of more possibilities...
Updated by Gerrit Code Review almost 13 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/8844
Updated by Gerrit Code Review almost 13 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/8844
Updated by Tolleiv Nietsch almost 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6ad942e8c16ba0be01bfe24816a7fdb0b70c4fcd.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed