1 user_role_layout_access.inc UserRoleLayoutAccess::summary()

Provides a human-readable summary of this access check's behavior.

Parameters

$contexts: An array containing available contexts.

Return value

string: The sanitized HTML summary string for this access check.

Overrides LayoutAccess::summary

File

core/modules/layout/plugins/access/user_role_layout_access.inc, line 20
Plugin to provide access control based upon role membership.

Class

UserRoleLayoutAccess
@file Plugin to provide access control based upon role membership.

Code

function summary() {
  $role_names = backdrop_map_assoc($this->settings['roles']);
  $roles = array_intersect_key(user_roles(), $role_names);
  if (empty($roles)) {
    return t('User can have any role');
  }
  if ($this->settings['negate']) {
    return format_plural(count($roles), 'User does not have the role @role', 'User does not have one of the following roles: @role', array('@role' => implode(', ', $roles)));
  }
  else {
    return format_plural(count($roles), 'User has the role @role', 'User has one of the following roles: @role', array('@role' => implode(', ', $roles)));
  }
}