I have a TV named ’x’, with a default value of ’default’.
And it only is accessible via template ’y’.
If I write a snippet like this:
$tv = $modx->getObject('modTemplateVar', array('name'=>'x'));
if ($menu = $tv->getValue($id)) {
return $menu;
}
I expect a value to be returned only if $id represents a resource that uses template ’y’.
Instead I get ’default’ returned in all of the following situations:
- $id = any valid resource regardless of what template it uses
- $id = a bogus number that doesn’t correspond to any resource
- $id = false
- $id = ’any freaking thing I make up’
Is my expectation wrong? If so, can someone please explain to me why this is the desired/expected behavior?