DefaultChoiceListFactory
in package
implements
ChoiceListFactoryInterface
Default implementation of {@link ChoiceListFactoryInterface}.
Tags
Interfaces, Classes, Traits and Enums
- ChoiceListFactoryInterface
- Creates {@link ChoiceListInterface} instances.
Table of Contents
- createListFromChoices() : ChoiceListInterface
- Creates a choice list for the given choices.
- createListFromLoader() : ChoiceListInterface
- Creates a choice list that is loaded with the given loader.
- createView() : ChoiceListView
- Creates a view for the given choice list.
- addChoiceView() : mixed
- addChoiceViewsFromStructuredValues() : mixed
- addChoiceViewsGroupedByCallable() : mixed
Methods
createListFromChoices()
Creates a choice list for the given choices.
public
createListFromChoices(mixed $choices[, mixed $value = null ]) : ChoiceListInterface
Parameters
- $choices : mixed
-
The choices
- $value : mixed = null
-
The callable generating the choice values
Return values
ChoiceListInterface —The choice list
createListFromLoader()
Creates a choice list that is loaded with the given loader.
public
createListFromLoader(ChoiceLoaderInterface $loader[, mixed $value = null ]) : ChoiceListInterface
Parameters
- $loader : ChoiceLoaderInterface
- $value : mixed = null
-
The callable generating the choice values
Return values
ChoiceListInterface —The choice list
createView()
Creates a view for the given choice list.
public
createView(ChoiceListInterface $list[, mixed $preferredChoices = null ][, mixed $label = null ][, mixed $index = null ][, mixed $groupBy = null ][, mixed $attr = null ]) : ChoiceListView
Parameters
- $list : ChoiceListInterface
- $preferredChoices : mixed = null
-
The preferred choices
- $label : mixed = null
-
The callable generating the choice labels; pass false to discard the label
- $index : mixed = null
-
The callable generating the view indices
- $groupBy : mixed = null
-
The callable generating the group names
- $attr : mixed = null
-
The callable generating the HTML attributes
Return values
ChoiceListView —The choice list view
addChoiceView()
private
static addChoiceView(mixed $choice, string $value, mixed $label, array<string|int, mixed> $keys, mixed &$index, mixed $attr, callable|null $isPreferred, array<string|int, mixed> &$preferredViews, array<string|int, mixed> &$preferredViewsOrder, array<string|int, mixed> &$otherViews) : mixed
Parameters
- $choice : mixed
- $value : string
- $label : mixed
- $keys : array<string|int, mixed>
- $index : mixed
- $attr : mixed
- $isPreferred : callable|null
- $preferredViews : array<string|int, mixed>
- $preferredViewsOrder : array<string|int, mixed>
- $otherViews : array<string|int, mixed>
Return values
mixed —addChoiceViewsFromStructuredValues()
private
static addChoiceViewsFromStructuredValues(array<string|int, mixed> $values, mixed $label, array<string|int, mixed> $choices, array<string|int, mixed> $keys, mixed &$index, mixed $attr, callable|null $isPreferred, array<string|int, mixed> &$preferredViews, array<string|int, mixed> &$preferredViewsOrder, array<string|int, mixed> &$otherViews) : mixed
Parameters
- $values : array<string|int, mixed>
- $label : mixed
- $choices : array<string|int, mixed>
- $keys : array<string|int, mixed>
- $index : mixed
- $attr : mixed
- $isPreferred : callable|null
- $preferredViews : array<string|int, mixed>
- $preferredViewsOrder : array<string|int, mixed>
- $otherViews : array<string|int, mixed>
Return values
mixed —addChoiceViewsGroupedByCallable()
private
static addChoiceViewsGroupedByCallable(callable $groupBy, mixed $choice, string $value, mixed $label, array<string|int, mixed> $keys, mixed &$index, mixed $attr, callable|null $isPreferred, array<string|int, mixed> &$preferredViews, array<string|int, mixed> &$preferredViewsOrder, array<string|int, mixed> &$otherViews) : mixed
Parameters
- $groupBy : callable
- $choice : mixed
- $value : string
- $label : mixed
- $keys : array<string|int, mixed>
- $index : mixed
- $attr : mixed
- $isPreferred : callable|null
- $preferredViews : array<string|int, mixed>
- $preferredViewsOrder : array<string|int, mixed>
- $otherViews : array<string|int, mixed>