RulesTrait
Form-level parameter rules (per form, not per handler).
Toggle rules show and hide groups and fields; required rules make fields required.
Parameters with a null type (dropped by mode) are skipped implicitly: isset($form[$key])
is false because ParameterFieldsTrait does not create them.
Table of Contents
Methods
- applyConditionsToElement() : void
- extractConditionValues() : array{0: int[], 1: string[]}
- initializeBlacklistedWordRules() : void
- initializeFormRules() : void
- initializeLengthRules() : void
- Upper limit of text values from the parameter `max_length` (admin › Parameters, "Max. number of characters").
- initializeRequiredRules() : void
- initializeToggleRules() : void
- initializeUrlRules() : void
- setRequiredForParameter() : void
- setRequiredForParametersInGroup() : void
- setRequiredForTargets() : void
- Sets the required flag for the targets.
Methods
applyConditionsToElement()
private
applyConditionsToElement(Form $form, ParameterInterface $parameter, ParameterRuleInterface $rule) : void
Parameters
- $form : Form
- $parameter : ParameterInterface
- $rule : ParameterRuleInterface
extractConditionValues()
private
extractConditionValues(ParameterRuleConditionInterface $condition) : array{0: int[], 1: string[]}
Parameters
- $condition : ParameterRuleConditionInterface
Return values
array{0: int[], 1: string[]}initializeBlacklistedWordRules()
private
initializeBlacklistedWordRules(Form $form) : void
Parameters
- $form : Form
initializeFormRules()
private
initializeFormRules(Form $form) : void
Parameters
- $form : Form
initializeLengthRules()
Upper limit of text values from the parameter `max_length` (admin › Parameters, "Max. number of characters").
private
initializeLengthRules(Form $form) : void
Every value is stored in a text column of *_advert_parameter_rel, so without a limit 70,000 characters
failed the save on the database (strict mode) with the generic "could not be saved" message. A plain field
gets MAX_LENGTH (also the maxlength attribute); with the editor the visible text is counted
(EditorTextLength), not the HTML. data-char-counter switches on the counter at the field
(char-counter.js), which counts the same way.
Parameters
- $form : Form
initializeRequiredRules()
private
initializeRequiredRules(Form $form, array<string|int, ParameterRuleInterface> $rules) : void
Parameters
- $form : Form
- $rules : array<string|int, ParameterRuleInterface>
initializeToggleRules()
private
initializeToggleRules(Form $form, array<string|int, ParameterRuleInterface> $rules) : void
Parameters
- $form : Form
- $rules : array<string|int, ParameterRuleInterface>
initializeUrlRules()
private
initializeUrlRules(Form $form) : void
Parameters
- $form : Form
setRequiredForParameter()
private
setRequiredForParameter(Form $form, int $parameterId, bool $required) : void
Parameters
- $form : Form
- $parameterId : int
- $required : bool
setRequiredForParametersInGroup()
private
setRequiredForParametersInGroup(Form $form, int $groupId, bool $required) : void
Parameters
- $form : Form
- $groupId : int
- $required : bool
setRequiredForTargets()
Sets the required flag for the targets.
private
setRequiredForTargets(Form $form, array<int|string, mixed> $targets, bool $required) : void
The items are ParameterRuleTargetInterface, but typed mixed: module entities return an
untyped Doctrine collection and the contract is enforced only by the instanceof below.
Parameters
- $form : Form
- $targets : array<int|string, mixed>
- $required : bool