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
PickerConfiggiftProductSetPicker()
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
PickerConfiggiftOfferSetName()
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
stringresolveGiftOfferSetLabel()
private
resolveGiftOfferSetLabel(int $id) : string|null
Parameters
- $id : int
Return values
string|nullsuggestGiftOfferSets()
private
suggestGiftOfferSets(string $query) : array<int, array{id: int, label: string}>
Parameters
- $query : string