Open Semdevmaster opened 3 years ago
The name and description of the context have never been part of the data stored in the context cache which is used to load a context when initialized. This may seem like a bug as you might expect that data to be available in the templates/snippets, but it is a feature request.
If I'm not mistake the rank
property isn't part of the data that's stored in the cache either. In the reporters example $modx->context->rank
returns 0
because it's the default value for the property.
Bug report
Summary
In templates or snippets
$modx->context->key;//works fine
$modx->context->rank;//works fine
$modx->context->name;//does not work (always empty string)
$modx->context->description;//does not work (always empty string)
Step to reproduce
create a snippet that returns data from the current context
Observed behavior
in all templates and snippets when requesting current context data, only key and rank available Name and description are always empty, although filled in the admin panel But
$res = $modx->getObject('modContext',['key'=>'web']); print_r($res->toArray());
Array ( [key] => web [name] => Москва [description] => Москва [rank] => 0 )
Works fineExpected behavior
$modx->context->name;//should output the data from admin panel
$modx->context->description;//should output the data from admin panel
Related issue(s)/PR(s)
Environment
MODX 2.8.1