function me_argument_uid_context in me aliases 6.2
Discover if this argument gives us the user we crave.
1 string reference to 'me_argument_uid_context'
- me_me_uid_ctools_arguments in plugins/
me_uid.inc - Implementation of CTools hook_ctools_arguments().
File
- plugins/
me_uid.inc, line 32 - Plugin to provide an argument handler for a user id which supports the me alias.
Code
function me_argument_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
// If unset it wants a generic, unfilled context.
if ($empty) {
return ctools_context_create_empty('user');
}
// We can accept either a user object or a pure uid.
if (is_object($arg)) {
return ctools_context_create('user', $arg);
}
// Convert the argument if needed.
$arg = _me_check_arg($arg);
if (!is_numeric($arg)) {
return NULL;
}
$account = user_load(array(
'uid' => $arg,
));
if (!$account) {
return NULL;
}
return ctools_context_create('user', $account);
}