function _batch_api_percentage

Same name in other branches
  1. 7.x includes/batch.inc \_batch_api_percentage()
  2. 9 core/includes/batch.inc \_batch_api_percentage()
  3. 8.9.x core/includes/batch.inc \_batch_api_percentage()
  4. 10 core/includes/batch.inc \_batch_api_percentage()

Formats the percent completion for a batch set.

Parameters

int $total: The total number of operations.

int|float $current: The number of the current operation. This may be a floating point number rather than an integer in the case of a multi-step operation that is not yet complete; in that case, the fractional part of $current represents the fraction of the operation that has been completed.

Return value

string The properly formatted percentage, as a string. We output percentages using the correct number of decimal places so that we never print "100%" until we are finished, but we also never print more decimal places than are meaningful.

See also

_batch_process()

1 call to _batch_api_percentage()
_batch_process in core/includes/batch.inc
Processes sets in a batch.

File

core/includes/batch.inc, line 397

Code

function _batch_api_percentage($total, $current) {
    return Percentage::format($total, $current);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.