ChoiceList
in package
A set of convenient static methods to create cacheable choice list options.
Tags
Table of Contents
Methods
- attr() : ChoiceAttr
- Decorates a "choice_attr" option to make it cacheable.
- fieldName() : ChoiceFieldName
- Decorates a "choice_name" callback to make it cacheable.
- filter() : ChoiceFilter
- groupBy() : GroupBy
- Decorates a "group_by" callback to make it cacheable.
- label() : ChoiceLabel
- Decorates a "choice_label" option to make it cacheable.
- lazy() : ChoiceLoader
- Creates a cacheable loader from any callable providing iterable choices.
- loader() : ChoiceLoader
- Decorates a loader to make it cacheable.
- preferred() : PreferredChoice
- Decorates a "preferred_choices" option to make it cacheable.
- translationParameters() : ChoiceTranslationParameters
- Decorates a "choice_translation_parameters" option to make it cacheable.
- value() : ChoiceValue
- Decorates a "choice_value" callback to make it cacheable.
- __construct() : mixed
- Should not be instantiated.
Methods
attr()
Decorates a "choice_attr" option to make it cacheable.
public
static attr(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $attr[, mixed $vary = null ]) : ChoiceAttr
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $attr : callable|array<string|int, mixed>
-
Any pseudo callable or array to create html attributes from a choice
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the option
Return values
ChoiceAttrfieldName()
Decorates a "choice_name" callback to make it cacheable.
public
static fieldName(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $fieldName[, mixed $vary = null ]) : ChoiceFieldName
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $fieldName : callable|array<string|int, mixed>
-
Any pseudo callable to create a field name from a choice
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the callback
Return values
ChoiceFieldNamefilter()
public
static filter(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $filter[, mixed $vary = null ]) : ChoiceFilter
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $filter : callable|array<string|int, mixed>
-
Any pseudo callable to filter a choice list
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the callback
Return values
ChoiceFiltergroupBy()
Decorates a "group_by" callback to make it cacheable.
public
static groupBy(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $groupBy[, mixed $vary = null ]) : GroupBy
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $groupBy : callable|array<string|int, mixed>
-
Any pseudo callable to return a group name from a choice
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the callback
Return values
GroupBylabel()
Decorates a "choice_label" option to make it cacheable.
public
static label(FormTypeInterface|FormTypeExtensionInterface $formType, callable|false $label[, mixed $vary = null ]) : ChoiceLabel
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $label : callable|false
-
Any pseudo callable to create a label from a choice or false to discard it
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the option
Return values
ChoiceLabellazy()
Creates a cacheable loader from any callable providing iterable choices.
public
static lazy(FormTypeInterface|FormTypeExtensionInterface $formType, callable $choices[, mixed $vary = null ]) : ChoiceLoader
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $choices : callable
-
A callable that must return iterable choices or grouped choices
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the loader
Return values
ChoiceLoaderloader()
Decorates a loader to make it cacheable.
public
static loader(FormTypeInterface|FormTypeExtensionInterface $formType, ChoiceLoaderInterface $loader[, mixed $vary = null ]) : ChoiceLoader
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $loader : ChoiceLoaderInterface
-
A loader responsible for creating loading choices or grouped choices
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the loader
Return values
ChoiceLoaderpreferred()
Decorates a "preferred_choices" option to make it cacheable.
public
static preferred(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $preferred[, mixed $vary = null ]) : PreferredChoice
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $preferred : callable|array<string|int, mixed>
-
Any pseudo callable or array to return a group name from a choice
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the option
Return values
PreferredChoicetranslationParameters()
Decorates a "choice_translation_parameters" option to make it cacheable.
public
static translationParameters(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $translationParameters[, mixed $vary = null ]) : ChoiceTranslationParameters
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $translationParameters : callable|array<string|int, mixed>
-
Any pseudo callable or array to create translation parameters from a choice
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the option
Return values
ChoiceTranslationParametersvalue()
Decorates a "choice_value" callback to make it cacheable.
public
static value(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array<string|int, mixed> $value[, mixed $vary = null ]) : ChoiceValue
Parameters
- $formType : FormTypeInterface|FormTypeExtensionInterface
- $value : callable|array<string|int, mixed>
-
Any pseudo callable to create a unique string value from a choice
- $vary : mixed = null
-
Dynamic data used to compute a unique hash when caching the callback
Return values
ChoiceValue__construct()
Should not be instantiated.
private
__construct() : mixed