Add unsetValueOption() to the Form\Element\Select and Form\Element\MultiCheckbox #5562

Merged
merged 2 commits into from Mar 4, 2014

4 participants

@bacinsky

It could be nice to have such a method to remove a value option from a form element in runtime.

Instead of this in the user land:

$valueOptions = $element->getValueOptions();
if (isset($valueOptions['something'])) {
    unset($valueOptions['something']);
    $element->setValueOptions($valueOptions);
}

just this:

$element->unsetValueOption('something');
@samsonasik samsonasik commented on an outdated diff Dec 3, 2013
library/Zend/Form/Element/MultiCheckbox.php
@@ -72,6 +72,19 @@ public function setValueOptions(array $options)
}
/**
+ * @param string $key
+ * @return Select
@samsonasik
samsonasik added a line comment Dec 3, 2013

@return self

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@samsonasik samsonasik commented on an outdated diff Dec 3, 2013
library/Zend/Form/Element/Select.php
@@ -85,6 +85,19 @@ public function setValueOptions(array $options)
}
/**
+ * @param string $key
+ * @return Select
@samsonasik
samsonasik added a line comment Dec 3, 2013

@return self

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w
Zend Framework member

@bacinsky Please send a PR to zf2-documentation too

@weierophinney weierophinney added this to the 2.3.0 milestone Mar 3, 2014
@weierophinney weierophinney self-assigned this Mar 4, 2014
@weierophinney weierophinney added a commit that referenced this pull request Mar 4, 2014
@weierophinney weierophinney Merge branch 'feature/5562' into develop
Close #5562
4a2d96a
@weierophinney weierophinney merged commit 1852f28 into zendframework:develop Mar 4, 2014

1 check failed

Details default The Travis CI build failed
@bacinsky bacinsky deleted the bacinsky:feature/select_and_multicheckbox_unset_value_option branch Mar 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment