CoolCMS API

OptionRuleSyncTrait

Synchronizes option rules (conditional display of options) from `meta['optionRules']` in `ParameterManager::afterSave`.

A rule = conditions (source parameter + validator + values) + a list of revealed option ids. It maps to ParameterRule action 1 (SHOW_SELECT_OPTIONS): one rule gives N target rows (each parameter_id = this select, option_id = a revealed option), see ParameterRuleGraphTrait::insertOptionRevealRuleGraph. The graph primitives come from that trait, which ParameterRuleSyncTrait brings into the manager.

Order in afterSave: after syncOptions (options already have stable ids) and scoped by action against the parameter's HIDE rules (they share the column parameter_id, told apart by action).

always_visible: controlled (revealed) options get 0 (the front end hides them until the condition holds); other options of the same parameter get 1. Removing a rule sets it back to 1.

NOTE: the meta['optionRules'] key is deprecated and has no real producer (the admin writes through the immediate-save RuleEditor/OptionRules component). Do not promote it to graphDataKeys: the delete-all semantics is a footgun without a real client.

Table of Contents

Properties

$em  : EntityManagerInterface

Methods

normalizeOptionRulesMeta()  : array<int, array{conditions: list, values: list}>, revealOptionIds: list}>
syncOptionRules()  : void

Properties

Methods

normalizeOptionRulesMeta()

private normalizeOptionRulesMeta(mixed $raw) : array<int, array{conditions: list, values: list}>, revealOptionIds: list}>
Parameters
$raw : mixed
Return values
array<int, array{conditions: list, values: list}>, revealOptionIds: list}>
On this page

Search results