UserGroupFormTrait
Add/edit form of a user group.
The skeleton (check, domain translator, save/update/cancel buttons, return to the previous page) comes from BasePresenter::createForm(). Multilingual fields and safe conversions come from AdminFormHelpersTrait.
A group has one translated attribute (name) and two untranslated settings (discount,
setAfterRegistration); no relation fields, so no picker.
Table of Contents
Methods
- createComponentEditForm() : Form
- addSettingsFields() : void
- Group settings: discount (0-100 %) and the set-after-registration flag.
- addTranslationFields() : void
- Multilingual fields: group name per language (`name_<langId>`), active per checkbox.
- buildUserGroupEntity() : UserGroup
- saveUserGroupForm() : bool
- Saves the form data. The redirect (to the previous page / "this") is handled by {@see \App\Core\Base\Admin\BasePresenter::createForm()} according to the pressed button.
- setUserGroupFormDefaults() : void
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormaddSettingsFields()
Group settings: discount (0-100 %) and the set-after-registration flag.
private
addSettingsFields(Form $form) : void
Parameters
- $form : Form
addTranslationFields()
Multilingual fields: group name per language (`name_<langId>`), active per checkbox.
private
addTranslationFields(Form $form) : void
Parameters
- $form : Form
buildUserGroupEntity()
private
buildUserGroupEntity(ArrayHash<string|int, mixed> $values) : UserGroup
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
UserGroupsaveUserGroupForm()
Saves the form data. The redirect (to the previous page / "this") is handled by {@see \App\Core\Base\Admin\BasePresenter::createForm()} according to the pressed button.
private
saveUserGroupForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetUserGroupFormDefaults()
private
setUserGroupFormDefaults(Form $form) : void
Parameters
- $form : Form