Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

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

Conversation

bacinsky
Copy link
Contributor

@bacinsky bacinsky commented Dec 2, 2013

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
Copy link
Contributor

+1

@@ -72,6 +72,19 @@ public function setValueOptions(array $options)
}

/**
* @param string $key
* @return Select
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@return self

@Maks3w
Copy link
Member

Maks3w commented Jan 2, 2014

@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 added a commit that referenced this pull request Mar 4, 2014
…ox_unset_value_option

Add unsetValueOption() to the Form\Element\Select and Form\Element\MultiCheckbox
weierophinney added a commit that referenced this pull request Mar 4, 2014
@weierophinney weierophinney merged commit 1852f28 into zendframework:develop Mar 4, 2014
@bacinsky bacinsky deleted the feature/select_and_multicheckbox_unset_value_option branch March 4, 2014 20:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants