interface ChoiceListInterface
deprecated
Contains choices that can be selected in a form field.
Each choice has three different properties:
array | getChoices() Returns the list of choices. | |
array | getValues() Returns the values for the choices. | |
array | getPreferredViews() Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys. | |
array | getRemainingViews() Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys. | |
array | getChoicesForValues(array $values) Returns the choices corresponding to the given values. | |
array | getValuesForChoices(array $choices) Returns the values corresponding to the given choices. | |
array | getIndicesForChoices(array $choices) deprecated Returns the indices corresponding to the given choices. | |
array | getIndicesForValues(array $values) deprecated Returns the indices corresponding to the given values. |
Returns the list of choices.
array | The choices with their indices as keys |
Returns the values for the choices.
array | The values with the corresponding choice indices as keys |
Returns the choice views of the preferred choices as nested array with the choice groups as top-level keys.
Example:
array | A nested array containing the views with the corresponding choice indices as keys on the lowest levels and the choice group names in the keys of the higher levels |
Returns the choice views of the choices that are not preferred as nested array with the choice groups as top-level keys.
Example:
array | A nested array containing the views with the corresponding choice indices as keys on the lowest levels and the choice group names in the keys of the higher levels |
getPreferredValues() |
Returns the choices corresponding to the given values.
The choices can have any data type.
The choices must be returned with the same keys and in the same order as the corresponding values in the given array.
array | $values | An array of choice values. Not existing values in this array are ignored |
array | An array of choices with ascending, 0-based numeric keys |
Returns the values corresponding to the given choices.
The values must be strings.
The values must be returned with the same keys and in the same order as the corresponding choices in the given array.
array | $choices | An array of choices. Not existing choices in this array are ignored |
array | An array of choice values with ascending, 0-based numeric keys |
deprecated
Returns the indices corresponding to the given choices.
The indices must be positive integers or strings accepted by {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}.
The index "placeholder" is internally reserved.
The indices must be returned with the same keys and in the same order as the corresponding choices in the given array.
array | $choices | An array of choices. Not existing choices in this array are ignored |
array | An array of indices with ascending, 0-based numeric keys |
deprecated
Returns the indices corresponding to the given values.
The indices must be positive integers or strings accepted by {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}.
The index "placeholder" is internally reserved.
The indices must be returned with the same keys and in the same order as the corresponding values in the given array.
array | $values | An array of choice values. Not existing values in this array are ignored |
array | An array of indices with ascending, 0-based numeric keys |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.html