ParameterFormContext
in package
Shared context of the parameter types: the mode (form/search), the language and preformatted items for special selects.
The mode decides whether ParameterForm reads getType()/getDefaultValue() or
getSearchType()/getSearchDefaultValue() from a parameter.
Table of Contents
Constants
- MODE_FORM : mixed = 'form'
- MODE_SEARCH : mixed = 'search'
Properties
- $blacklistedWordMessage : string
- $blacklistedWords : array<string|int, string>
- $comcatAdvertItems : array<int, string>
- $currencyItems : array<int, string>
- $defaultCurrencyId : int|null
- Default currency of the currency select (`SELECT_CURRENCY`) for a new value; on the front end the website currency (localization region).
- $keepOptionIds : array<int, true>
- Option ids the edited record already holds: a disabled option (`active = 0`) is not offered, except to a record that already has it (a select with a value out of its items would drop it on save). Filled by `ParameterFieldBuilder::build()` from the entity values.
- $languageId : int|null
- $mode : string
- $optionCounts : array<int, array<string|int, int>>
- Item counts of the filter options ("Sony 3"): `parameterId => [value => count]`.
- $rangeBounds : array<int, array{min: float, max: float}>
- Slider bounds of range parameters: `parameterId => ['min' => float, 'max' => float]`.
- $regionInvalidMessage : string
- Message for an invalid region selection; the consumer supplies it translated together with the validator.
- $regionItems : array<int, string>
- $regionLabelResolver : callable(int): Array|null
- `REGION_PICKER`: region label by id (`id => ?string`) for the active filter badge.
- $regionValidator : callable(int): bool|null
- `REGION_PICKER`: server-side check of the selected region (`id => bool`).
- $urlNotAllowedMessage : string
- Validation messages of the content filter, injectable per module/locale.
Constants
MODE_FORM
public
mixed
MODE_FORM
= 'form'
MODE_SEARCH
public
mixed
MODE_SEARCH
= 'search'
Properties
$blacklistedWordMessage
public
string
$blacklistedWordMessage
= 'Pole obsahuje zakázané slovo.'
$blacklistedWords
public
array<string|int, string>
$blacklistedWords
= []
words forbidden in fields with throwErrorOnBlacklistedWord enabled
$comcatAdvertItems
module-specific leak into Core, kept only for SelectComcatAdvertHandler, which is not registered in ParameterHandlerRegistry::createDefault(); do not use
public
array<int, string>
$comcatAdvertItems
= []
id => label
$currencyItems
public
array<int, string>
$currencyItems
= []
id => label
$defaultCurrencyId
Default currency of the currency select (`SELECT_CURRENCY`) for a new value; on the front end the website currency (localization region).
public
int|null
$defaultCurrencyId
= null
Overrides the parameter default_value, but only when it is one of currencyItems
(SelectCurrencyHandler::resolveDefaultValue()).
With null the parameter default_value applies.
$keepOptionIds
Option ids the edited record already holds: a disabled option (`active = 0`) is not offered, except to a record that already has it (a select with a value out of its items would drop it on save). Filled by `ParameterFieldBuilder::build()` from the entity values.
public
array<int, true>
$keepOptionIds
= []
$languageId
public
int|null
$languageId
= null
$mode
public
string
$mode
= self::MODE_FORM
$optionCounts
Item counts of the filter options ("Sony 3"): `parameterId => [value => count]`.
public
array<int, array<string|int, int>>
$optionCounts
= []
Filled by the LoadingTrait of a module that can count (currently the e-shop). An empty array
means the module supplied no counts and
AbstractParameterHandler::getOptionItems() behaves as without counts,
so adverts and the company catalog are unaffected.
The value of a relation is text (enums carry the option id), so the key is looked up via (string) $id.
IMPORTANT: the declared key type is array-key, not string: PHP converts a numeric string
key to int, so ['12' => 3] is really [12 => 3]; a lookup assuming string keys misses it.
$rangeBounds
Slider bounds of range parameters: `parameterId => ['min' => float, 'max' => float]`.
public
array<int, array{min: float, max: float}>
$rangeBounds
= []
Filled by the LoadingTrait of a module (same pattern as $optionCounts); Core never
computes them because that would need a module relation manager. An empty array means the
module supplied no bounds and the filter renders as two number fields; the slider is a
progressive enhancement, not a replacement.
$regionInvalidMessage
Message for an invalid region selection; the consumer supplies it translated together with the validator.
public
string
$regionInvalidMessage
= 'Vyberte obec z nabídky.'
$regionItems
public
array<int, string>
$regionItems
= []
id => label
$regionLabelResolver
`REGION_PICKER`: region label by id (`id => ?string`) for the active filter badge.
public
callable(int): Array|null
$regionLabelResolver
= null
With null the badge shows the bare id.
$regionValidator
`REGION_PICKER`: server-side check of the selected region (`id => bool`).
public
callable(int): bool|null
$regionValidator
= null
Filled by the consumer in buildContext() using RegionManager::findLocality() (advert form:
only an active municipality, a tree leaf). With null the rule is not added (filter, modules without region).
$urlNotAllowedMessage
Validation messages of the content filter, injectable per module/locale.
public
string
$urlNotAllowedMessage
= 'Pole nesmí obsahovat URL adresu.'
A module may override them from the translator in its LoadingTrait (like currencyItems
and regionItems). Core must not hardcode them in RulesTrait.