|
Revision 16232, 1.8 kB
(checked in by fabien, 4 years ago)
|
[1.2, 1.3] fixed typo in PHPDoc (closes #5821)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfWidgetFormI18nSelectCurrency extends sfWidgetFormSelect |
|---|
| 20 |
{ |
|---|
| 21 |
|
|---|
| 22 |
* Constructor. |
|---|
| 23 |
* |
|---|
| 24 |
* Available options: |
|---|
| 25 |
* |
|---|
| 26 |
* * culture: The culture to use for internationalized strings (required) |
|---|
| 27 |
* * currencies: An array of currency codes to use (ISO 4217) |
|---|
| 28 |
* * add_empty: Whether to add a first empty value or not (false by default) |
|---|
| 29 |
* If the option is not a Boolean, the value will be used as the text value |
|---|
| 30 |
* |
|---|
| 31 |
* @param array $options An array of options |
|---|
| 32 |
* @param array $attributes An array of default HTML attributes |
|---|
| 33 |
* |
|---|
| 34 |
* @see sfWidgetFormSelect |
|---|
| 35 |
*/ |
|---|
| 36 |
protected function configure($options = array(), $attributes = array()) |
|---|
| 37 |
{ |
|---|
| 38 |
parent::configure($options, $attributes); |
|---|
| 39 |
|
|---|
| 40 |
$this->addRequiredOption('culture'); |
|---|
| 41 |
$this->addOption('currencies'); |
|---|
| 42 |
$this->addOption('add_empty', false); |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
$culture = isset($options['culture']) ? $options['culture'] : 'en'; |
|---|
| 46 |
|
|---|
| 47 |
$currencies = sfCultureInfo::getInstance($culture)->getCurrencies(isset($options['currencies']) ? $options['currencies'] : null); |
|---|
| 48 |
|
|---|
| 49 |
$addEmpty = isset($options['add_empty']) ? $options['add_empty'] : false; |
|---|
| 50 |
if (false !== $addEmpty) |
|---|
| 51 |
{ |
|---|
| 52 |
$currencies = array_merge(array('' => true === $addEmpty ? '' : $addEmpty), $currencies); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
$this->setOption('choices', $currencies); |
|---|
| 56 |
} |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|