1 user_permission_layout_access.inc UserPermissionLayoutAccess::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_permission_layout_access.inc, line 20
Plugin to provide access control based on user permission strings.

Class

UserPermissionLayoutAccess
@file Plugin to provide access control based on user permission strings.

Code

function summary() {
  if (empty($this->settings['permission'])) {
    return t('Error, unset permission');
  }

  $permissions = module_invoke_all('permission');
  if (!array_key_exists($this->settings['permission'], $permissions)) {
    return t('User has missing "@permission" permission (not provided by any module).', array(
      '@permission' => $this->settings['permission'],
    ));
  }
  return t('User has "@permission" permission.', array('@permission' => $permissions[$this->settings['permission']]['title']));
}