You are here

function ctools_role_ctools_access_summary in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/access/role.inc \ctools_role_ctools_access_summary()

Provide a summary description based upon the checked roles.

1 string reference to 'ctools_role_ctools_access_summary'
role.inc in plugins/access/role.inc
Plugin to provide access control based upon role membership.

File

plugins/access/role.inc, line 61
Plugin to provide access control based upon role membership.

Code

function ctools_role_ctools_access_summary($conf, $context) {
  if (!isset($conf['rids'])) {
    $conf['rids'] = array();
  }
  $roles = ctools_get_roles();
  $names = array();
  foreach (array_filter($conf['rids']) as $rid) {
    $names[] = check_plain($roles[$rid]);
  }
  if (empty($names)) {
    return t('@identifier can have any role', array(
      '@identifier' => $context->identifier,
    ));
  }
  return format_plural(count($names), '@identifier has role "@roles"', '@identifier has one of "@roles"', array(
    '@roles' => implode(', ', $names),
    '@identifier' => $context->identifier,
  ));
}