This class manages the displaying of the edit/create mask containing the widgets.

It also handles the persisting of the model.

 Methods

Create the edit mask.

__construct(\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\BackendViewInterface $view, \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model, \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $originalModel, callable $preFunction, callable $postFunction, string $breadcrumb) 

Parameters

$model

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model with the current data.

$originalModel

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The data from the original data.

$preFunction

callable

The function to call before saving an item.

$postFunction

callable

The function to call after saving an item.

$breadcrumb

string

The rendered breadcrumb.

Create the edit mask.

execute() : string
SuppressWarnings (PHPMD.LongVariable)

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException If the data container is not editable, closed.
\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException If an unknown property is encountered in the palette.

Returns

string

Build the field sets.

buildFieldSet(\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ContaoWidgetManager $widgetManager, \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface $palette, \ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag $propertyValues) : array

Ensure the view is editable and throw an Exception if not.

checkCreatable(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model) : void

Parameters

$model

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model to be edited, if this is given, we are not in create mode.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When the definition is not editable.

Ensure the view is editable and throw an Exception if not.

checkEditable(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model) : void

Parameters

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When the definition is not editable.

Clear the backend messages and offset states.

clearBackendStates() : void
SuppressWarnings (PHPMD.Superglobals)
SuppressWarnings (PHPMD.CamelCaseVariableName)

Handle the persisting of the currently loaded model.

doPersist() : void

Ensure a property is defined in the data definition and raise an exception if it is unknown.

ensurePropertyExists(string $property, \ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\PropertiesDefinitionInterface $propertyDefinitions) : void

Parameters

$property

string

The property name to check.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException When the property is not registered in the definition.

Get the label for a button from the translator.

getButtonLabel(string $buttonLabel) : string
The fallback is as follows: 1. Try to translate the button via the data definition name as translation section. 2. Try to translate the button name with the prefix 'MSC.'. 3. Return the input value as nothing worked out.

Parameters

$buttonLabel

string

The non translated label for the button.

Returns

string

Retrieve a list of html buttons to use in the bottom panel (submit area).

getEditButtons() : string[]

Returns

string[]

Retrieve the manual sorting property if any is defined.

getManualSortingProperty() : string | null

Returns

stringnull

Trigger the post persist event and handle the postPersist function if available.

handlePostPersist() : void

Trigger the pre persist event and handle the prePersist function if available.

handlePrePersist() : void

Handle the submit and determine which button has been triggered.

handleSubmit(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model) : void
This method will redirect the client.
SuppressWarnings (PHPMD.Superglobals)
SuppressWarnings (PHPMD.CamelCaseVariableName)

Parameters

$model

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model that has been submitted.

Determines if this view is opened in a popup frame.

isPopup() : bool

Returns

bool

Process input and return all modified properties or null if there is no input.

processInput(\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ContaoWidgetManager $widgetManager) : null | \ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag

Update the versioning information in the data provider for a given model (if necessary).

storeVersion(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model) : void
SuppressWarnings (PHPMD.LongVariable)

Parameters

 Properties

 

The rendered breadcrumb.

$breadcrumb : string
 

The errors from the widgets.

$errors : array
 

The model to be manipulated.

$model : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
 

The original model from the database.

$originalModel : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
 

The method to be executed after the model is persisted.

$postFunction : callable | null
 

The method to be executed before the model is persisted.

$preFunction : callable | null