CoolCMS API

GiftOfferSetPickerTrait

Picker of the product sets a gift is offered with ({@see \App\Core\Base\Shared\Eshop\Models\Entities\Gift::$offerSets}, M:N `cms_mod_eshop_gift_product_set_rel`); repeated selection in a multiplier row, like {@see ProductCategoryPickerTrait::productCategoryMultiPicker()}.

The modal and the suggest both target :Admin:Eshop:ProductSet, whose grid supports picker mode with a translations.name label (see ProductSetPresenter::createComponentGrid()). Requires $this->productSetManager.

Table of Contents

Methods

giftOfferSetMultiPicker()  : PickerConfig
giftProductSetPicker()  : PickerConfig
Single-field picker for "the gift is this product set" ({@see \App\Core\Base\Shared\Eshop\Models\Entities\Gift::$productSet}, nullable), like {@see ProductCategoryPickerTrait::productCategoryParentPicker()}.
giftOfferSetName()  : string
Returns the set name in the current language (falls back to the first non-empty one).
resolveGiftOfferSetLabel()  : string|null
suggestGiftOfferSets()  : array<int, array{id: int, label: string}>

Methods

giftOfferSetMultiPicker()

protected giftOfferSetMultiPicker([string $container = 'offerSets' ][, string $targetField = 'productSetId' ][, string $displayField = 'productSetName' ][, string $formName = 'editForm' ]) : PickerConfig
Parameters
$container : string = 'offerSets'
$targetField : string = 'productSetId'
$displayField : string = 'productSetName'
$formName : string = 'editForm'
Return values
PickerConfig

giftProductSetPicker()

Single-field picker for "the gift is this product set" ({@see \App\Core\Base\Shared\Eshop\Models\Entities\Gift::$productSet}, nullable), like {@see ProductCategoryPickerTrait::productCategoryParentPicker()}.

protected giftProductSetPicker([string $formName = 'editForm' ][, string $targetField = 'productSetId' ]) : PickerConfig
Parameters
$formName : string = 'editForm'
$targetField : string = 'productSetId'
Return values
PickerConfig

giftOfferSetName()

Returns the set name in the current language (falls back to the first non-empty one).

private giftOfferSetName(ProductSet $set) : string
Parameters
$set : ProductSet
Return values
string

resolveGiftOfferSetLabel()

private resolveGiftOfferSetLabel(int $id) : string|null
Parameters
$id : int
Return values
string|null

suggestGiftOfferSets()

private suggestGiftOfferSets(string $query) : array<int, array{id: int, label: string}>
Parameters
$query : string
Return values
array<int, array{id: int, label: string}>
On this page

Search results