Permalink
Browse files

NumberHelper now also uses the default currency from CakeNumber, inst…

…ead of default argument value
  • Loading branch information...
1 parent 967bf8e commit fda331eab169068763717f88838032b7c0c02c29 @ceeram committed Oct 7, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/Cake/View/Helper/NumberHelper.php
@@ -126,11 +126,12 @@ public function format($number, $options = false) {
* @param float $number
* @param string $currency Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise
* set at least 'before' and 'after' options.
+ * 'USD' is the default currency, use CakeNumber::defaultCurrency() to change this default.
* @param array $options
* @return string Number formatted as a currency.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::currency
*/
- public function currency($number, $currency = 'USD', $options = array()) {
+ public function currency($number, $currency = null, $options = array()) {
return $this->_engine->currency($number, $currency, $options);
}
@@ -147,4 +148,15 @@ public function addFormat($formatName, $options) {
return $this->_engine->addFormat($formatName, $options);
}
+/**
+ * @see: CakeNumber::defaultCurrency()
+ *
+ * @param string $currency The currency to be used in the future.
+ * @return void
+ * @see NumberHelper::currency()
+ */
+ public function defaultCurrency($currency) {
+ return $this->_engine->defaultCurrency($currency);
+ }
+
}

0 comments on commit fda331e

Please sign in to comment.