EventFormTrait
Edit/add form of an event.
Multilingual fields (name, perex, editor description); untranslated: event dates (start required, end optional), publish date, event address and activation (toggle in the header). The skeleton comes from BasePresenter::createForm().
Table of Contents
Constants
- EVENT_DT_FORMAT : mixed = 'Y-m-d\TH:i'
- Value format of `<input type=datetime-local>`.
Methods
- createComponentEditForm() : Form
- addMainFields() : void
- Untranslated fields: dates, publish date, address, author, region/user (picker), image, activation.
- addTranslationFields() : void
- Multilingual fields: one set per language (`<field>_<langId>`), active according to the checkbox.
- buildEventEntity() : Event
- collectImageMeta() : array<string, mixed>
- Builds `$meta` for save: a new image (base64) and/or the delete flag.
- saveEventForm() : bool
- setEventFormDefaults() : void
Constants
EVENT_DT_FORMAT
Value format of `<input type=datetime-local>`.
private
mixed
EVENT_DT_FORMAT
= 'Y-m-d\TH:i'
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormaddMainFields()
Untranslated fields: dates, publish date, address, author, region/user (picker), image, activation.
private
addMainFields(Form $form) : void
Parameters
- $form : Form
addTranslationFields()
Multilingual fields: one set per language (`<field>_<langId>`), active according to the checkbox.
private
addTranslationFields(Form $form) : void
Parameters
- $form : Form
buildEventEntity()
private
buildEventEntity(ArrayHash<string|int, mixed> $values) : Event
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
EventcollectImageMeta()
Builds `$meta` for save: a new image (base64) and/or the delete flag.
private
collectImageMeta(ArrayHash<string|int, mixed> $values) : array<string, mixed>
The Api turns it into an Asset (variants) and sets the FK to the main image.
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
array<string, mixed>saveEventForm()
private
saveEventForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetEventFormDefaults()
private
setEventFormDefaults(Form $form) : void
Parameters
- $form : Form