function ctools_context_user_convert in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 plugins/contexts/user.inc \ctools_context_user_convert()
Convert a context into a string.
1 string reference to 'ctools_context_user_convert'
File
- plugins/
contexts/ user.inc, line 167 - Plugin to provide a user context
Code
function ctools_context_user_convert($context, $type) {
switch ($type) {
case 'uid':
return $context->data->uid;
case 'name':
return $context->data->name;
}
// Check if token.module can provide the replacement.
if (module_exists('token')) {
$values = token_get_values('user', $context->data);
$key = array_search($type, $values->tokens);
if ($key !== FALSE) {
return $values->values[$key];
}
}
}