CoolCMS API

FormTrait

Base feed fields and the save orchestration of the whole form.

The base fields go through the generic object-graph save (FeedManager::save()); the parameter tree goes through a dedicated bridge action right after it, because it needs the real feedId of a new entity. Both happen in one form submit. Overrides and category mappings are not edited here, see FeedEdit.

Table of Contents

Properties

$feedCurrencies  : array<int, Currency>
$feedLanguages  : array<int, Language>
$feedParameterActionOptions  : array<int, NotTranslate>

Methods

createComponentEditForm()  : Form
addFeedBaseFields()  : void
buildFeedEntity()  : Feed
currentLangIdOrDefault()  : int
loadFeedSelectData()  : void
Loads the select data (languages, currencies, actions) once per request.
saveFeedForm()  : bool
setFeedFormDefaults()  : void
Prefills the base fields and the parameter tree multiplier (including the nested level) in a single `setDefaults()`.

Properties

$feedParameterActionOptions

private array<int, NotTranslate> $feedParameterActionOptions = []

id => translated action name (falls back to the raw action string).

Methods

createComponentEditForm()

protected createComponentEditForm() : Form
Return values
Form

addFeedBaseFields()

private addFeedBaseFields(Form $form) : void
Parameters
$form : Form

buildFeedEntity()

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

currentLangIdOrDefault()

private currentLangIdOrDefault() : int
Return values
int

loadFeedSelectData()

Loads the select data (languages, currencies, actions) once per request.

private loadFeedSelectData() : void

saveFeedForm()

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

setFeedFormDefaults()

Prefills the base fields and the parameter tree multiplier (including the nested level) in a single `setDefaults()`.

private setFeedFormDefaults(Form $form) : void

IMPORTANT: the multiplier is filled only through nested arrays in the defaults, never by addCopy()/setValues() on single copies; see ParameterTreeTrait::buildParameterTreeDefaultRows().

Parameters
$form : Form
On this page

Search results