ChoiceLoader
class ChoiceLoader extendsAbstractStaticOption implementsChoiceLoaderInterface
A cacheable wrapper for {see FormTypeInterface} or {see FormTypeExtensionInterface} which configures a "choice_loader" option.
Methods
Loads a list of choices.
Loads the choices corresponding to the given values.
Loads the values corresponding to the given choices.
Details
ChoiceListInterface
loadChoiceList(callable$value =null)
Loads a list of choices.
Optionally, a callable can be passed for generating the choice values. The callable receives the choice as only argument. Null may be passed when the choice list contains the empty value.
array
loadChoicesForValues(array$values,callable$value =null)
Loads the choices corresponding to the given values.
The choices are returned with the same keys and in the same order as the corresponding values in the given array.
Optionally, a callable can be passed for generating the choice values. The callable receives the choice as only argument. Null may be passed when the choice list contains the empty value.
array
loadValuesForChoices(array$choices,callable$value =null)
Loads the values corresponding to the given choices.
The values are returned with the same keys and in the same order as the corresponding choices in the given array.
Optionally, a callable can be passed for generating the choice values. The callable receives the choice as only argument. Null may be passed when the choice list contains the empty value.