function og_token_values in Organic groups 5
Same name and namespace in other branches
- 5.8 og.module \og_token_values()
- 5.3 og.module \og_token_values()
- 5.7 og.module \og_token_values()
- 6.2 og.module \og_token_values()
- 6 og.module \og_token_values()
Implementation of hook_token_values() for og specific tokens
File
- ./
og.module, line 2917
Code
function og_token_values($type, $object = NULL) {
switch ($type) {
case 'node':
if (is_array($object->og_groups)) {
$gids = array_filter($object->og_groups);
foreach ($gids as $gid) {
$title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $gid));
$values['ogname'] = check_plain($title);
$values['ogname-raw'] = $title;
$values['og-id'] = $gid;
break;
}
return $values;
}
break;
}
// No group info found. Return defaults.
$values['ogname'] = '';
$values['ogname-raw'] = '';
$values['og-id'] = '';
return $values;
}