Template Variable Checkbox
Using a Template Variable of input type "check box" with snippets you may need to know:
- the returned value of "modx->getTemplateVar()" is either null or the value set by the "input option values"-field in the TV definition
- you can also ask for the value as true / false, where the returned value is true when the checkbox is checked regardless which content has been defined for that case by the "input option values"-field in the TV definition:
- if you don't assign a default value in the TV definition, then the default value is null
- if you do assign a default value, then you can't uncheck the box (!). Because with check-box-TVs MODx doesn't distinguish between 'null' and 'false', every time you open a resource to edit the default value is assigned => the box gets checked.
So if you want a snippet to react in a certain way if a resources has a certain property defined by a check-box-TV, and you want this behaviour to be the default (you don't want to edit more resources than necessary), then you have to design it the other way round: define a TV that covers the information that the resource has not that certain property:
Tested with MODx 1.0.4 / Martin.lindenlauf 16:31, 28 September 2010 (PDT)