You are here

function context_condition_user::condition_values in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_user.inc \context_condition_user::condition_values()
  2. 7.3 plugins/context_condition_user.inc \context_condition_user::condition_values()

Condition values.

Overrides context_condition::condition_values

File

plugins/context_condition_user.inc, line 7

Class

context_condition_user
Expose current user role as a context condition.

Code

function condition_values() {
  $values = array();
  foreach (user_roles() as $rid => $role_name) {
    if ($rid == DRUPAL_ANONYMOUS_RID) {
      $values['anonymous user'] = check_plain($role_name);
    }
    elseif ($rid == DRUPAL_AUTHENTICATED_RID) {
      $values['authenticated user'] = check_plain($role_name);
    }
    else {
      $values[$role_name] = check_plain($role_name);
    }
  }
  return $values;
}