<?php

/**
 * Smarty plugin.
 */

/**
 * Smarty {format_editable_price} function plugin.
 *
 * @param Decimal $decimal   - value to format
 * @param null    $precision - how many decimal places to use. Use negative numbers to pretty print rounded values (strip trailing zeros)
 *
 * @return string
 */
function smarty_modifier_format_editable_price(Decimal $decimal, $precision = null)
{
    return $decimal->printFloatValue($precision ?: 2);
}
