UserPaymentFormTrait
Add/edit form of a user payment.
The skeleton comes from BasePresenter::createForm(). Flat
entity. userId = user picker (hidden, required), tariffId = select (TariffManager),
paymentId = plain numeric input for now (to become a picker).
Table of Contents
Constants
- UP_DT_FORMAT : mixed = 'Y-m-d\TH:i'
- Value format of `<input type=datetime-local>`.
Methods
- createComponentEditForm() : Form
- prepareTariffOptions() : array<int, string>
- Tariff options: `id => title` (current language, fallback to the first non-empty one).
- saveUserPaymentForm() : bool
- setUserPaymentFormDefaults() : void
- tariffOptionLabel() : string
- tr() : string
- Translates a key in the form domain into a final string (for fields with `setTranslator(null)`).
Constants
UP_DT_FORMAT
Value format of `<input type=datetime-local>`.
private
mixed
UP_DT_FORMAT
= 'Y-m-d\TH:i'
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormprepareTariffOptions()
Tariff options: `id => title` (current language, fallback to the first non-empty one).
private
prepareTariffOptions() : array<int, string>
Return values
array<int, string>saveUserPaymentForm()
private
saveUserPaymentForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetUserPaymentFormDefaults()
private
setUserPaymentFormDefaults(Form $form) : void
Parameters
- $form : Form
tariffOptionLabel()
private
tariffOptionLabel(Tariff $tariff, int|null $currentLang) : string
Parameters
- $tariff : Tariff
- $currentLang : int|null
Return values
stringtr()
Translates a key in the form domain into a final string (for fields with `setTranslator(null)`).
private
tr(string $key) : string
Parameters
- $key : string