CoolCMS API

CustomAssetFormTrait

Add/edit form of a single custom code in the library (`Admin:System:CustomAsset`).

A code is edited as one record, so a plain PRG form (createForm()) saves it, with no multiplier. The multiplier in the page tab only assigns existing codes, see CustomAssetTabTrait.

IMPORTANT: the cookieCategory field is a select over the cookie bar categories (CookieConsentConfig), not its own list; two independent copies of the same enumeration would silently drift apart.

Table of Contents

Methods

createComponentEditForm()  : Form
buildCustomAssetRow()  : array<string, mixed>
customAssetCookieOptions()  : array<string, string>
customAssetPlacementOptions()  : array<string, string>
customAssetTypeOptions()  : array<string, string>
saveCustomAssetForm()  : bool
Saves the form after a preflight check with the same normalizer the Api uses to validate the payload before its transaction ({@see CustomAssetPayload::normalizeAsset()}).
setCustomAssetFormDefaults()  : void

Methods

buildCustomAssetRow()

private buildCustomAssetRow(ArrayHash<string|int, mixed> $values) : array<string, mixed>
Parameters
$values : ArrayHash<string|int, mixed>
Return values
array<string, mixed>

customAssetCookieOptions()

private customAssetCookieOptions() : array<string, string>
Return values
array<string, string> —

option value to absolute translation key

customAssetPlacementOptions()

private customAssetPlacementOptions() : array<string, string>
Return values
array<string, string> —

option value to absolute translation key

customAssetTypeOptions()

private customAssetTypeOptions() : array<string, string>
Return values
array<string, string> —

option value to absolute translation key

saveCustomAssetForm()

Saves the form after a preflight check with the same normalizer the Api uses to validate the payload before its transaction ({@see CustomAssetPayload::normalizeAsset()}).

private saveCustomAssetForm(ArrayHash<string|int, mixed> $values) : bool

The Api check stays the authority; this one only saves a pointless HTTP call.

Parameters
$values : ArrayHash<string|int, mixed>
Return values
bool
On this page

Search results