You are here

function hosting_quota_resource_render in Hostmaster (Aegir) 6

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 modules/hosting/quota/hosting_quota.admin.inc
Page callback for admin/hosting/quotas
hosting_quota_get_all_info in modules/hosting/quota/hosting_quota.module
Get the rendered usage and info for all resources

File

modules/hosting/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;
}