function user_colors_classes in Colors 7
Implements hook_colors_classes().
Provide colors per user role.
File
- includes/
user.colors.inc, line 39 - Provides Color integration on behalf of user.module.
Code
function user_colors_classes($entity) {
$class_names = array();
if (variable_get('colors_user_role_enabled', FALSE)) {
if ($entity->entity_type == 'user' && !empty($entity->roles)) {
foreach ($entity->roles as $role_id => $role) {
$class_names[] = 'colors-user-role-' . $role_id;
}
}
}
if (variable_get('colors_user_current_enabled', FALSE)) {
global $user;
if (!empty($entity->uid) && $user->uid == $entity->uid) {
$class_names[] = 'colors-user-current-0';
}
}
if (variable_get('colors_users_enabled', FALSE)) {
if ($entity->entity_type == 'user' || $entity->entity_type == 'node') {
$class_names[] = 'colors-users-' . $entity->uid;
}
}
return $class_names;
}