/** * {@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(); }
/** * {@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(); }
/** * @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(); }
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(); }
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()); }
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); }
public function getValueOptions() { $options = parent::getValueOptions(); return true === $this->getOption('include_all_option') ? array_merge(['all' => 'All'], $options) : $options; }