You are here

function hosting_quota_resource_render in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 quota/hosting_quota.module \hosting_quota_resource_render()
  2. 7.3 quota/hosting_quota.module \hosting_quota_resource_render()

Rendering function for quotas

Parameters

$resource: Either a resource retrieved via hosting_quota_get or the machine name of a resource

$usage int: The usage as returned by hosting_quota_get_usage

Return value

The rendered usage string

2 calls to hosting_quota_resource_render()
hosting_quota_admin_client_list in quota/hosting_quota.admin.inc
Page callback for admin/hosting/quotas
hosting_quota_get_all_info in quota/hosting_quota.module
Get the rendered usage and info for all resources

File

quota/hosting_quota.module, line 127
Implement quota's for the resource used by client.

Code

function hosting_quota_resource_render($resource, $usage) {
  $rendered_usage = '';
  if (!is_array($resource)) {
    $resource = hosting_quota_get($resource);
  }
  $resource_name = key($resource);
  $resource = $resource[$resource_name];
  if ($resource['module']) {
    $rendered_usage = module_invoke($resource['module'], 'hosting_quota_resource_render', $resource_name, $usage);
  }
  return $rendered_usage;
}