CoolCMS API

AdminComponentFormTrait

Component counterpart of {@see BasePresenter::createForm()}: same skeleton (backKey, update/save gate, redirects).

A component has no direct access to the presenter methods resolveFormBackKey() and redirectToFormBack(), so it delegates to $this->getPresenter(). The host must extends BaseComponent (provides $translator and $translatorDomain, see BaseComponent).

Table of Contents

Methods

createAdminComponentForm()  : Form

Methods

createAdminComponentForm()

protected createAdminComponentForm(callable(ArrayHash<string|int, mixed>, Form=): bool $processData[, callable(string): void|null $afterSave = null ]) : Form
Parameters
$processData : callable(ArrayHash<string|int, mixed>, Form=): bool

Saves the data; returns success (handles its own flash).

$afterSave : callable(string): void|null = null

When set, replaces the default backKey/redirect logic after a successful $processData; the parameter is the clicked submit name (update or save). The hidden backKey stays in the form but is unused. For a component hosted in a modal shell, where a page redirect makes no sense (the modal is an AJAX shell over the presenter page).

Return values
Form
On this page

Search results