function rolereference_field_formatter in Role Reference 5
Implementation of hook_field_formatter().
File
- ./
rolereference.module, line 81 - Defines a field type for referencing a role.
Code
function rolereference_field_formatter($field, $item, $formatter, $role) {
$text = '';
if (isset($item['rid'])) {
$roles = _rolereference_get_roles();
$referenced_role = $roles[$item['rid']];
if ($referenced_role) {
$text = $referenced_role;
}
}
switch ($formatter) {
case 'plain':
return strip_tags($text);
default:
return $text;
}
}