You are here

function interval_format_interval in Interval Field 7

Formats an interval

Takes the given interval values and formats them as a string

Parameters

array $item: An array of values for the interval item consisting of:

  • interval: the interval (int)
  • period: the interval period

Return value

string The formatted interval

1 call to interval_format_interval()
interval_field_formatter_view in ./interval.module
Implements hook_field_formatter_view().

File

./interval.module, line 516
Defines an interval field @copyright Copyright(c) 2011 Rowlands Group @license GPL v2+ http://www.fsf.org/licensing/licenses/gpl.html @author Lee Rowlands leerowlands at rowlandsgroup dot com

Code

function interval_format_interval($item) {
  $intervals = interval_get_intervals();
  $interval = $intervals[$item['period']];
  return format_plural($item['interval'], '1 @singular', '@count @plural', array(
    '@singular' => $interval['singular'],
    '@plural' => $interval['plural'],
  ));
}