CoolCMS API

ComponentPickerHostTrait

Component counterpart of {@see \App\UI\Admin\System\Presenters\Traits\Pickers\PickerHostTrait}: the same `createComponentPicker()`/`parsePickerName()` logic, but `$this->error()` is presenter-only and does not exist on a component, so an unknown picker throws `LogicException`.

AbstractRuleEditor (AbstractRuleEditor) keeps its own inline copy of this logic; this trait is for further consumers such as ProductSetEdit.

Requires $this->pickerFactory in the host (constructor injection; #[Inject] is not filled on a component) and the abstract pickers().

Table of Contents

Methods

createComponentPicker()  : Multiplier<string|int, Picker>
pickers()  : array<string, PickerConfig>
Returns the picker configuration of the component, keyed by logical name. Must be pure and idempotent: it is also called for the AJAX signal `suggest!`, when the form may not be built yet.
parsePickerName()  : array{0: string, 1: list}
Splits a picker instance name into the config key and the multiplier row indices; see {@see \App\UI\Admin\System\Presenters\Traits\Pickers\PickerHostTrait::parsePickerName()} for the full explanation of the separator.

Methods

pickers()

Returns the picker configuration of the component, keyed by logical name. Must be pure and idempotent: it is also called for the AJAX signal `suggest!`, when the form may not be built yet.

protected abstract pickers() : array<string, PickerConfig>
Return values
array<string, PickerConfig>

parsePickerName()

Splits a picker instance name into the config key and the multiplier row indices; see {@see \App\UI\Admin\System\Presenters\Traits\Pickers\PickerHostTrait::parsePickerName()} for the full explanation of the separator.

private parsePickerName(string $name) : array{0: string, 1: list}
Parameters
$name : string
Return values
array{0: string, 1: list}
On this page

Search results