CoolCMS API

DependentSelectTrait

Converts a select whose options are targets of rules with {@see \App\Core\Base\Shared\Bazaar\Models\Entities\ParameterRule::ACTION_SHOW_SELECT_OPTIONS} to a {@see DependentSelectBox}.

Items are loaded via AJAX after the parent changes (signal dependentSelectBoxLoad on the hosting UI control). On the initial render the items are filled from the parent values of the entity (edit mode) or from parameter defaults (insert mode).

Table of Contents

Methods

areAllConditionsMet()  : bool
buildDependentData()  : DependentData
collectOptionLabels()  : array<int, string>
collectRuleControlledOptionIds()  : array<int, true>
collectShowSelectOptionsRules()  : array<string|int, ParameterRuleInterface>
collectSourceKeys()  : array<string|int, string>
extractParameterIdFromKey()  : int|null
initializeFormElementDependencies()  : void
isConditionMet()  : bool
replaceWithDependentSelect()  : void
resolveInitialParentValues()  : array<string, mixed>
resolveOptionLabel()  : string

Methods

extractParameterIdFromKey()

private extractParameterIdFromKey(string $controlKey) : int|null
Parameters
$controlKey : string
Return values
int|null

resolveInitialParentValues()

private resolveInitialParentValues(Form $form, array<string|int, string> $sourceKeys, array<int, mixed> $entityValues) : array<string, mixed>
Parameters
$form : Form
$sourceKeys : array<string|int, string>
$entityValues : array<int, mixed>
Return values
array<string, mixed>
On this page

Search results