|
Revision 75, 1.2 kB
(checked in by nperriault, 5 months ago)
|
[1.1]:
- Companies and people modules migrated, with according form classes and templates, and functional test suite
- Enhanced SymfoniansTestBrowser?
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
class CountrySelectorForm extends sfForm |
|---|
| 9 |
{ |
|---|
| 10 |
protected |
|---|
| 11 |
$countries = array(), |
|---|
| 12 |
$culture = 'en'; |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
* Public constructor |
|---|
| 16 |
* |
|---|
| 17 |
* @param array $countries An optional list of country codes |
|---|
| 18 |
* @see sfForm |
|---|
| 19 |
*/ |
|---|
| 20 |
public function __construct($countries = array(), $defaults = array(), $options = array(), $CSRFSecret = null) |
|---|
| 21 |
{ |
|---|
| 22 |
$this->countries = array_keys($countries); |
|---|
| 23 |
$this->culture = sfContext::getInstance()->getUser()->getCulture(); |
|---|
| 24 |
|
|---|
| 25 |
parent::__construct($defaults, $options, $CSRFSecret); |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
* Form configuration |
|---|
| 30 |
* |
|---|
| 31 |
*/ |
|---|
| 32 |
public function setup() |
|---|
| 33 |
{ |
|---|
| 34 |
$this->setWidgets(array( |
|---|
| 35 |
'country' => new ExtendedWidgetFormI18nSelectCountry(array('culture' => $this->culture, |
|---|
| 36 |
'countries' => $this->countries, |
|---|
| 37 |
'add_label_option' => __('Any country'))), |
|---|
| 38 |
)); |
|---|
| 39 |
|
|---|
| 40 |
$this->setValidators(array( |
|---|
| 41 |
'country' => new sfValidatorI18nChoiceCountry(array('culture' => $this->culture, |
|---|
| 42 |
'countries' => $this->countries)), |
|---|
| 43 |
)); |
|---|
| 44 |
} |
|---|
| 45 |
} |
|---|
| 46 |
|
|---|