本文整理汇总了PHP中Zend\Form\Element\Select::getValueOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::getValueOptions方法的具体用法?PHP Select::getValueOptions怎么用?PHP Select::getValueOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Select
的用法示例。
在下文中一共展示了Select::getValueOptions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValueOptions
/**
* {@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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: testDeprecateOptionsInAttributes
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());
}
示例6: testUnsetUndefinedValueOption
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);
}
示例7: getValueOptions
public function getValueOptions()
{
$options = parent::getValueOptions();
return true === $this->getOption('include_all_option') ? array_merge(['all' => 'All'], $options) : $options;
}