Skip to content

Commit

Permalink
Add empty option before empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
vseager committed Oct 25, 2012
1 parent 0abbba9 commit 4b602ad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions library/Zend/Form/View/Helper/FormSelect.php
Expand Up @@ -78,17 +78,18 @@ public function render(ElementInterface $element)
}

$options = $element->getValueOptions();

if (($emptyOption = $element->getEmptyOption()) !== null) {
$options = array('' => $emptyOption) + $options;
}

if (empty($options)) {
throw new Exception\DomainException(sprintf(
'%s requires that the element has "value_options"; none found',
__METHOD__
));
}

if (($emptyOption = $element->getEmptyOption()) !== null) {
$options = array('' => $emptyOption) + $options;
}

$attributes = $element->getAttributes();
$value = $this->validateMultiValue($element->getValue(), $attributes);

Expand Down

0 comments on commit 4b602ad

Please sign in to comment.