You are here

function farm_inventory_format in farmOS 7

Format an inventory value.

Parameters

string $inventory: The inventory value to format.

Return value

string The formatted inventory string.

2 calls to farm_inventory_format()
farm_inventory in modules/farm/farm_inventory/farm_inventory.module
Calculate an asset's inventory level.
farm_inventory_handler_field_asset_inventory_value::render in modules/farm/farm_inventory/views/handlers/farm_inventory_handler_field_asset_inventory_value.inc
Render the field.

File

modules/farm/farm_inventory/farm_inventory.module, line 441

Code

function farm_inventory_format($inventory) {

  // Add zero (to remove trailing zeroes).
  // See https://stackoverflow.com/questions/14531679/remove-useless-zero-digits-from-decimals-in-php
  $inventory += 0;

  // Convert to a string.
  $inventory = (string) $inventory;

  // Return the inventory.
  return $inventory;
}