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->pollPlaceManagerPollPlaceManager$this->editedPlace?PollPlace (null when adding)$this->translatorDomainstring (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
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormaddPollMultiplier()
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
addPollPlaceFields()
private
addPollPlaceFields(Form $form) : void
Parameters
- $form : Form
buildPollPlaceEntity()
private
buildPollPlaceEntity(ArrayHash<string|int, mixed> $values) : PollPlace
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
PollPlaceextractPollIds()
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
stringsavePollPlaceForm()
private
savePollPlaceForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetPollPlaceFormDefaults()
private
setPollPlaceFormDefaults(Form $form) : void
Parameters
- $form : Form