CoolCMS API

PollPlaceFormTrait

Add/edit form of a poll place.

Fields: name + the multiplier polls (selection of polls through Picker — every row is a hidden pollId + the label poll, see PollPickerTrait). The link is saved as the owned collection pollRels of PollPlaceRel rows: an id reference to the poll plus the order taken from the row position.

Presenter dependencies:

  • $this->pollPlaceManager PollPlaceManager
  • $this->editedPlace ?PollPlace (null when adding)
  • $this->translatorDomain string (from BasePresenter)

Table of Contents

Methods

createComponentEditForm()  : Form
addPollMultiplier()  : void
Multiplier of polls. Every row carries a hidden `pollId` (saved) and a text `poll` (Picker label / suggest field). Create/remove buttons have the `ajax` class, so naja redraws the `polls` snippet.
addPollPlaceFields()  : void
buildPollPlaceEntity()  : PollPlace
extractPollIds()  : array<int, int>
Positive poll ids from the `polls` multiplier. Empty rows are skipped.
nStr()  : string
savePollPlaceForm()  : bool
setPollPlaceFormDefaults()  : void

Methods

addPollMultiplier()

Multiplier of polls. Every row carries a hidden `pollId` (saved) and a text `poll` (Picker label / suggest field). Create/remove buttons have the `ajax` class, so naja redraws the `polls` snippet.

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

buildPollPlaceEntity()

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

extractPollIds()

Positive poll ids from the `polls` multiplier. Empty rows are skipped.

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

nStr()

private nStr(mixed $value) : string
Parameters
$value : mixed
Return values
string

savePollPlaceForm()

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

Search results