ChoiceFilter example

public static function value(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array $value, mixed $vary = null): ChoiceValue
    {
        return new ChoiceValue($formType$value$vary);
    }

    /** * @param callable|array $filter Any pseudo callable to filter a choice list * @param mixed $vary Dynamic data used to compute a unique hash when caching the callback */
    public static function filter(FormTypeInterface|FormTypeExtensionInterface $formType, callable|array $filter, mixed $vary = null): ChoiceFilter
    {
        return new ChoiceFilter($formType$filter$vary);
    }

    /** * Decorates a "choice_label" option to make it cacheable. * * @param callable|false $label Any pseudo callable to create a label from a choice or false to discard it * @param mixed $vary Dynamic data used to compute a unique hash when caching the option */
    public static function label(FormTypeInterface|FormTypeExtensionInterface $formType, callable|false $label, mixed $vary = null): ChoiceLabel
    {
        return new ChoiceLabel($formType$label$vary);
    }
Home | Imprint | This part of the site doesn't use cookies.