CoolCMS API

ParameterRuleInterface

Parameter rule: conditions (`conditions`) plus targets (`targets`).

IMPORTANT: the effect is derived from the target, not from action (see Core RulesTrait and DependentSelectTrait):

  • a target with optionId != null reveals select options (dependent select),
  • a target with parameterId / parameterGroupId (and optionId == null) toggles a field or group or makes it conditionally required.

The interface keeps the Core rule layer from being typed on the entities of one module. Typing it on one module's entities makes rules of other modules silently drop out: the pool stays empty and toggle, required and dependent-select rules are skipped without an error.

Table of Contents

Constants

ACTION_HIDE  : mixed = 2
ACTION_SHOW_SELECT_OPTIONS  : mixed = 1
`action` values, common to all modules (see {@see self::getAction()}).

Methods

getAction()  : int
Legacy flag (1 reveals options, 2 hides them); it no longer decides the effect, see the class comment.
getConditions()  : array<int|string, mixed>
Elements are {@see ParameterRuleConditionInterface}. The type is `mixed` on purpose: module entities keep conditions in an untyped Doctrine `Collection`, so a stronger promise would be false. Only the `instanceof` guard in Core (`RulesTrait`/`DependentSelectTrait`) enforces it, so it must stay.
getConditionsCollection()  : Collection<int, ParameterRuleConditionInterface>
getId()  : int|null
getTargets()  : array<int|string, mixed>
Elements are {@see ParameterRuleTargetInterface}; for why `mixed`, see {@see self::getConditions()}.
getTargetsCollection()  : Collection<int, ParameterRuleTargetInterface>

Constants

ACTION_SHOW_SELECT_OPTIONS

`action` values, common to all modules (see {@see self::getAction()}).

public mixed ACTION_SHOW_SELECT_OPTIONS = 1

Methods

getAction()

Legacy flag (1 reveals options, 2 hides them); it no longer decides the effect, see the class comment.

public getAction() : int
Return values
int

getConditions()

Elements are {@see ParameterRuleConditionInterface}. The type is `mixed` on purpose: module entities keep conditions in an untyped Doctrine `Collection`, so a stronger promise would be false. Only the `instanceof` guard in Core (`RulesTrait`/`DependentSelectTrait`) enforces it, so it must stay.

public getConditions() : array<int|string, mixed>
Return values
array<int|string, mixed>

getTargets()

Elements are {@see ParameterRuleTargetInterface}; for why `mixed`, see {@see self::getConditions()}.

public getTargets() : array<int|string, mixed>
Return values
array<int|string, mixed>
On this page

Search results