NewsFormTrait
Edit/add form of a news item.
Multilingual fields (title, perex, editor text); untranslated: activation (toggle in the header) and publish date. The skeleton comes from BasePresenter::createForm().
Table of Contents
Constants
- NEWS_DT_FORMAT : mixed = 'Y-m-d\TH:i'
- Value format of `<input type=datetime-local>`.
Methods
- createComponentEditForm() : Form
- addMainFields() : void
- Untranslated fields: activation and publish date.
- addTranslationFields() : void
- Multilingual fields: one set per language (`<field>_<langId>`), active according to the checkbox.
- buildNewsEntity() : News
- saveNewsForm() : bool
- setNewsFormDefaults() : void
Constants
NEWS_DT_FORMAT
Value format of `<input type=datetime-local>`.
private
mixed
NEWS_DT_FORMAT
= 'Y-m-d\TH:i'
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormaddMainFields()
Untranslated fields: activation and publish date.
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
buildNewsEntity()
private
buildNewsEntity(ArrayHash<string|int, mixed> $values) : News
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
NewssaveNewsForm()
private
saveNewsForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetNewsFormDefaults()
private
setNewsFormDefaults(Form $form) : void
Parameters
- $form : Form