CoolCMS API

SupplyKindDefaultTrait

Preselected supply kind of a new item, for presenters ({@see \App\Core\Traits\Admin\Presenters\SupplyKindFieldsTrait}) and components.

Components cannot use #[Inject]; their manager arrives through the constructor, so it is passed as a parameter.

Order: the kind with machine key $preferredKey (shipping, service; the same fallback as Api SupplyKindManager::findFallbackId() in beforeSave), then the kind with is_default, then the first select option. Only among the offered options ($options), never a hard-coded id.

Table of Contents

Methods

resolveSupplyKindDefaultId()  : int|null

Methods

resolveSupplyKindDefaultId()

protected resolveSupplyKindDefaultId(SupplyKindManager $manager, array<int, mixed> $options[, string|null $preferredKey = null ]) : int|null
Parameters
$manager : SupplyKindManager
$options : array<int, mixed>

select options (SupplyKindManager::findSelectOptions())

$preferredKey : string|null = null
Return values
int|null
On this page

Search results