RatingFormTrait
Edit of a single rating from the central list ({@see \App\UI\Admin\Base\Presenters\RatingPresenter}).
The fields deliberately match the form in the thread tab (RatingThread) — the same data must not be edited differently on two screens.
IMPORTANT: threadId is not editable (moving a rating under another object would throw off the
summaries of both threads), nor are votesUp/votesDown/reports (counters derived from the
votes table — a manual overwrite would diverge them from the rows) or userId/ip (who wrote
what is a record, not editable data).
Table of Contents
Methods
- createComponentEditForm() : Form
- listToText() : string
- saveRatingForm() : bool
- setRatingFormDefaults() : void
- textToList() : array<int, string>|null
- Textarea to an array of items. Empty lines are dropped; empty input gives null (the column is nullable and an empty array could not be told apart from "not filled in").
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormlistToText()
private
listToText(array<int, string>|null $items) : string
Parameters
- $items : array<int, string>|null
Return values
stringsaveRatingForm()
private
saveRatingForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetRatingFormDefaults()
private
setRatingFormDefaults(Form $form) : void
Parameters
- $form : Form
textToList()
Textarea to an array of items. Empty lines are dropped; empty input gives null (the column is nullable and an empty array could not be told apart from "not filled in").
private
textToList(mixed $value) : array<int, string>|null
Parameters
- $value : mixed