Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function getValueOptions()
 {
     if (!count($this->valueOptions)) {
         $locales = $this->getLocaleList();
         $options = parent::getValueOptions();
         foreach ($locales as $code => $name) {
             $options[$code] = $this->getDisplayNames() ? $name : $code;
         }
         $this->setValueOptions($options);
     }
     return parent::getValueOptions();
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function getValueOptions()
 {
     if (!count($this->valueOptions)) {
         $currencies = $this->getCurrencyList()->getCurrencies();
         $options = parent::getValueOptions();
         foreach ($currencies as $currency) {
             $name = $this->getDisplayNames() ? $currency->getName() : $currency->getIsoCode();
             $options[$currency->getIsoCode()] = $name;
         }
         $this->setValueOptions($options);
     }
     return parent::getValueOptions();
 }
Ejemplo n.º 3
0
 /**
  * @return array
  */
 public function getValueOptions()
 {
     if (!count($this->valueOptions)) {
         $names = Currency::getAvailableCurrencyNames();
         $codes = $this->getCurrencyList()->getAllow();
         $options = parent::getValueOptions();
         foreach ($codes as $code) {
             $name = $this->getDisplayNames() ? $names[$code] : $code;
             $options[$code] = $name;
         }
         $this->setValueOptions($options);
     }
     return parent::getValueOptions();
 }
Ejemplo n.º 4
0
 public function getValueOptions()
 {
     if ($this->initialized) {
         return parent::getValueOptions();
     }
     $this->initialized = true;
     $valueOptions = [];
     foreach ($this->clientRepository->findAllActive() as $client) {
         $valueOptions[$client->getId()] = $client->getName();
     }
     $this->setValueOptions($valueOptions);
     $this->insertSelectedClientIfRequired($this->value);
     return parent::getValueOptions();
 }
Ejemplo n.º 5
0
 public function testDeprecateOptionsInAttributes()
 {
     $element = new SelectElement();
     $valueOptions = array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3');
     $element->setAttributes(array('multiple' => true, 'options' => $valueOptions));
     $this->assertEquals($valueOptions, $element->getValueOptions());
 }
Ejemplo n.º 6
0
 public function testUnsetUndefinedValueOption()
 {
     $element = new SelectElement();
     $element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $element->unsetValueOption('Option Undefined');
     $valueOptions = $element->getValueOptions();
     $this->assertArrayNotHasKey('Option Undefined', $valueOptions);
 }
Ejemplo n.º 7
0
 public function getValueOptions()
 {
     $options = parent::getValueOptions();
     return true === $this->getOption('include_all_option') ? array_merge(['all' => 'All'], $options) : $options;
 }