Feature #68613
closed
TypoScript: NOT EQUALS condition operator for condition: [applicationContext]
Added by Christian Weiske over 9 years ago.
Updated almost 8 years ago.
Description
It would be helpful if there was a "not equals" operator in typoscript conditions, !=
.
Goal is to check if an applicationContext
is NOT Development
.
- Subject changed from TypoScript: NOT EQUALS condition operator to TypoScript: NOT EQUALS condition operator for condition: [applicationContext]
I change the subject because some conditions already have the operator "!=":
hour,minute,month,year ,dayofweek,dayofmonth, dayofyear,globalVar
- Status changed from New to Needs Feedback
Hey Christian,
unfortunately this is not so easy to implement, as the applicationContext condition only has one "=" as comparator, thus the ConditionMatcher cannot evaluate the comparison parameter. additionally, we have the problem that you can add a comma-separated list which also works (without the "=") as a equals symbol as well,
I would therefore suggest to do it like this:
[applicationContext = Testing, Production]
THIS IS EVERYTHING EXCEPT DEVELOPMENT
or
[applicationContext = Development]
[else]
[end]
I fear if we add this feature for applicationContext, we'd need to add it to the other missing conditions as well, making it a real breaking change for all TypoScripts out there.
btw: The !=/>/< is only implemented for number comparisons (year, globalVar, etc) currently.
Just a side note on ApplicationContext:
There are only two valid main contexts, which are "Production" and "Development". "Testing" is internal and must only be used in TYPO3 core tests.
- Status changed from Needs Feedback to Closed
Closed:
- number comparison conditions will remain the only ones that have the "!=/>/<" comparison operators for now.
- there are some alternatives to obtain the "!=" like using [else]
If you think that this is the wrong decision or that more work should be done on this area please reopen it.
Thank you
Also available in: Atom
PDF