You are here

public function ServicesClientUserRoleCondition::getSummary in Services Client 7.2

Retrieve condition summary for UI.

Return value

string UI short summary.

Overrides ServicesClientConditionInterface::getSummary

File

include/condition.inc, line 369

Class

ServicesClientUserRoleCondition

Code

public function getSummary() {
  if (empty($this->config['roles'])) {
    return '[ ' . t('User roles condition - not configured') . ' ]';
  }
  else {
    $intersect = $this->config['intersect'] ? t('all') : t('at least one');
    $roles = array();
    foreach ($this->config['roles'] as $rid => $role) {
      $role = user_role_load($role);
      $roles[] = $role->name;
    }
    return format_string('User has @intersect of these roles: @roles', array(
      '@intersect' => $intersect,
      '@roles' => implode(', ', $roles),
    ));
  }
}