| Conditions | 6 |
| Paths | 8 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 4 | protected function configure($options = array(), $attributes = array()) |
||
| 5 | {
|
||
| 6 | parent::configure($options, $attributes); |
||
| 7 | |||
| 8 | $this->addOption('culture', sfContext::getInstance()->getUser()->getCulture());
|
||
| 9 | $this->addOption('currencies');
|
||
| 10 | $this->addOption('add_empty', false);
|
||
| 11 | |||
| 12 | // populate choices with all currencies |
||
| 13 | $culture = isset($options['culture']) ? $options['culture'] : 'en'; |
||
| 14 | |||
| 15 | $currencies = sfCultureInfo::getInstance($culture)->getCurrencies(isset($options['currencies']) ? $options['currencies'] : null); |
||
| 16 | |||
| 17 | $addEmpty = isset($options['add_empty']) ? $options['add_empty'] : false; |
||
| 18 | if (false !== $addEmpty) |
||
| 19 | {
|
||
| 20 | $currencies = array_merge(array('' => true === $addEmpty ? '' : $addEmpty), $currencies);
|
||
| 21 | } |
||
| 22 | |||
| 23 | $this->setOption('choices', $currencies);
|
||
| 24 | } |
||
| 25 | } |