Overview

Namespaces

  • DcGeneral
    • Clipboard
    • Contao
      • Callback
      • Compatibility
      • DataDefinition
        • Definition
      • Dca
        • Builder
          • Legacy
        • Definition
        • Palette
        • Populator
      • Event
      • View
        • Contao2BackendView
          • Event
    • Controller
    • Data
    • DataDefinition
      • Builder
      • Definition
        • Properties
        • View
          • Panel
      • ModelRelationship
      • Palette
        • Builder
          • Event
        • Condition
          • Palette
          • Property
    • EnvironmentPopulator
    • Event
    • Exception
    • Factory
      • Event
    • Panel
    • View
      • Event

Classes

  • BaseView
  • ContaoBackendViewTemplate
  • ContaoWidgetManager
  • ListView
  • ParentView
  • TreeView

Interfaces

  • BackendViewInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Class BaseView

Class BaseView.

This class is the base class for the different backend view mode sub classes.

DcGeneral\Contao\View\Contao2BackendView\BaseView implements DcGeneral\Contao\View\Contao2BackendView\BackendViewInterface

Direct known subclasses

DcGeneral\Contao\View\Contao2BackendView\ListView, DcGeneral\Contao\View\Contao2BackendView\ParentView, DcGeneral\Contao\View\Contao2BackendView\TreeView
Namespace: DcGeneral\Contao\View\Contao2BackendView
Package: DcGeneral\Contao\View\Contao2BackendView
Located at Contao/View/Contao2BackendView/BaseView.php
Methods summary
protected
# dispatchEvent( string $eventName, Symfony\Component\EventDispatcher\Event $event )

Dispatch an event to the dispatcher.

Dispatch an event to the dispatcher.

The event will first get triggered with the name of the active data provider within square brackets appended and plain afterwards.

Example: Event name: "some-event" DP name: "tl_table"
1. dispatch: "some-event[tl_table]" 2. dispatch: "some-event"

Deprecated

Use $this->getEnvironment()->getEventPropagator()->propagate() instead.

Parameters

$eventName
string
$eventName The name of the event to dispatch.
$event
Symfony\Component\EventDispatcher\Event
$event The event to dispatch.
public ViewInterface
# setEnvironment( DcGeneral\EnvironmentInterface $environment )

Set the environment.

Set the environment.

Parameters

$environment
DcGeneral\EnvironmentInterface
$environment

Returns

ViewInterface

Implementation of

DcGeneral\View\ViewInterface::setEnvironment()
public DcGeneral\EnvironmentInterface
# getEnvironment( )

Retrieve the attached environment.

Retrieve the attached environment.

Returns

DcGeneral\EnvironmentInterface

Implementation of

DcGeneral\View\ViewInterface::getEnvironment()
protected DcGeneral\DataDefinition\ContainerInterface
# getDataDefinition( )

Retrieve the data definition from the environment.

Retrieve the data definition from the environment.

Returns

DcGeneral\DataDefinition\ContainerInterface
protected string
# translate( string $path, string|null $section = null )

Translate a string via the translator.

Translate a string via the translator.

Parameters

$path
string
$path The path within the translation where the string can be found.
$section
string|null
$section The section from which the translation shall be retrieved.

Returns

string
protected DcGeneral\Contao\View\Contao2BackendView\BaseView
# addToTemplate( string $name, mixed $value, Template $template )

Add the value to the template.

Add the value to the template.

Parameters

$name
string
$name Name of the value.
$value
mixed
$value The value to add to the template.
$template
Template
$template The template to add the value to.

Returns

DcGeneral\Contao\View\Contao2BackendView\BaseView
public DcGeneral\Contao\View\Contao2BackendView\BackendViewInterface
# setPanel( DcGeneral\Panel\PanelContainerInterface $panelContainer )

Set the panel container.

Set the panel container.

Parameters

$panelContainer
DcGeneral\Panel\PanelContainerInterface
$panelContainer The panel container.

Returns

DcGeneral\Contao\View\Contao2BackendView\BackendViewInterface

Implementation of

DcGeneral\Contao\View\Contao2BackendView\BackendViewInterface::setPanel()
public DcGeneral\Panel\PanelContainerInterface
# getPanel( )

Retrieve the panel container from the view.

Retrieve the panel container from the view.

Returns

DcGeneral\Panel\PanelContainerInterface

Implementation of

DcGeneral\Contao\View\Contao2BackendView\BackendViewInterface::getPanel()
protected DcGeneral\Contao\DataDefinition\Definition\Contao2BackendViewDefinitionInterface
# getViewSection( )

Retrieve the view section for this view.

Retrieve the view section for this view.

Returns

DcGeneral\Contao\DataDefinition\Definition\Contao2BackendViewDefinitionInterface
protected
# redirectHome( )

Redirects to the real back end module.

Redirects to the real back end module.

protected boolean
# isPopup( )

Determines if this view is opened in a popup frame.

Determines if this view is opened in a popup frame.

Returns

boolean
protected boolean
# isSelectModeActive( )

Determine if the select mode is currently active or not.

Determine if the select mode is currently active or not.

Returns

boolean
protected array|null
# getGroupingMode( )

Retrieve the currently active grouping mode.

Retrieve the currently active grouping mode.

Returns

array|null

See

DcGeneral\DataDefinition\Definition\View\ListingConfigInterface
public string
# formatCurrentValue( string $field, DcGeneral\Data\ModelInterface $model, string $groupMode, integer $groupLength )

Return the formatted value for use in group headers as string.

Return the formatted value for use in group headers as string.

Parameters

$field
string
$field The name of the property to format.
$model
DcGeneral\Data\ModelInterface
$model The model from which the value shall be taken from.
$groupMode
string
$groupMode The grouping mode in use.
$groupLength
integer
$groupLength The length of the value to use for grouping (only used when grouping mode is ListingConfigInterface::GROUP_CHAR).

Returns

string
protected string
# getButtonLabel( string $strButton )

Get the label for a button from the translator.

Get the label for a button from the translator.

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

$strButton
string
$strButton The non translated label for the button.

Returns

string
protected array
# getEditButtons( )

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

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

Returns

array
protected array
# getSelectButtons( )

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

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

Returns

array
public DcGeneral\Contao\View\Contao2BackendView\BaseView
# checkClipboard( )

Update the clipboard in the Environment with data from the InputProvider.

Update the clipboard in the Environment with data from the InputProvider.

The following parameters have to be provided by the input provider:

Name Type Description clipboard bool Flag determining if the clipboard shall get cleared. act string Action to perform, either paste, cut or create. id mixed The Id of the item to copy. In mode cut this is the id of the item to be moved.

Returns

DcGeneral\Contao\View\Contao2BackendView\BaseView
protected boolean
# isMultiLanguage( mixed $mixId )

Determine if we are currently working in multi language mode.

Determine if we are currently working in multi language mode.

Parameters

$mixId
mixed
$mixId The id of the current model.

Returns

boolean
protected
# checkLanguage( )

Check if the data provider is multi language and prepare the data provider with the selected language.

Check if the data provider is multi language and prepare the data provider with the selected language.

protected DcGeneral\Contao\View\Contao2BackendView\ContaoBackendViewTemplate
# getTemplate( string $strTemplate )

Create a new instance of ContaoBackendViewTemplate with the template file of the given name.

Create a new instance of ContaoBackendViewTemplate with the template file of the given name.

Parameters

$strTemplate
string
$strTemplate Name of the template to create.

Returns

DcGeneral\Contao\View\Contao2BackendView\ContaoBackendViewTemplate
public string
# handleAjaxCall( )

TODO: Handle an ajax call, this method is currently not implemented.

TODO: Handle an ajax call, this method is currently not implemented.

Returns

string

Implementation of

DcGeneral\View\ViewInterface::handleAjaxCall()
public string
# copy( )

Returns

string

Todo

All

Implementation of

DcGeneral\View\ViewInterface::copy()
public string
# copyAll( )

Returns

string

Todo

All

Implementation of

DcGeneral\View\ViewInterface::copyAll()
public string
# create( )

Create a new item.

Create a new item.

Returns

string

See

DcGeneral\Contao\View\Contao2BackendView\BaseView::edit()

Implementation of

DcGeneral\View\ViewInterface::create()
public string
# cut( )

Returns

string

Todo

All

Implementation of

DcGeneral\View\ViewInterface::cut()
public
# paste( )

Implementation of

DcGeneral\View\ViewInterface::paste()
public string
# cutAll( )

Returns

string

Todo

All

Implementation of

DcGeneral\View\ViewInterface::cutAll()
public
# delete( )

Delete a model and redirect the user to the listing.

Delete a model and redirect the user to the listing.

NOTE: This method redirects the user to the listing and therefore the script will be ended.

Throws

DcGeneral\Exception\DcGeneralRuntimeException
If the model to delete could not be loaded.

Implementation of

DcGeneral\View\ViewInterface::delete()
public string
# move( )

Returns

string

Todo

All

Implementation of

DcGeneral\View\ViewInterface::move()
public string
# undo( )

Returns

string

Todo

All

Implementation of

DcGeneral\View\ViewInterface::undo()
protected
# handleSubmit( DcGeneral\Data\ModelInterface $model )

Handle the submit and determine which button has been triggered.

Handle the submit and determine which button has been triggered.

This method will redirect the client.

Parameters

$model
DcGeneral\Data\ModelInterface
$model The model that has been submitted.
protected
# checkRestoreVersion( )

Check the submitted data if we want to restore a previous version of a model.

Check the submitted data if we want to restore a previous version of a model.

If so, the model will get loaded and marked as active version in the data provider and the client will perform a reload of the page.

Throws

DcGeneral\Exception\DcGeneralRuntimeException
When the requested version could not be located in the database.
public
# enforceModelRelationship( DcGeneral\Data\ModelInterface $model )

Abstract method to be overridden in the certain child classes.

Abstract method to be overridden in the certain child classes.

This method will update the parent relationship between a model and the parent item.

Parameters

$model
DcGeneral\Data\ModelInterface
$model The model to be updated.
protected DcGeneral\Data\ModelInterface
# createEmptyModelWithDefaults( )

Create an empty model using the default values from the definition.

Create an empty model using the default values from the definition.

Returns

DcGeneral\Data\ModelInterface
protected
# storeVersion( DcGeneral\Data\ModelInterface $model )

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

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

Parameters

$model
DcGeneral\Data\ModelInterface
$model The model to update.
public string
# edit( )

Generate the view for edit.

Generate the view for edit.

Returns

string

Throws

DcGeneral\Exception\DcGeneralRuntimeException
When the current data definition is not editable or is closed.
DcGeneral\Exception\DcGeneralInvalidArgumentException
When an unknown property is mentioned in the palette.

Implementation of

DcGeneral\View\ViewInterface::edit()
protected string
# createEditMask( DcGeneral\Data\ModelInterface $model, DcGeneral\Data\ModelInterface $originalModel, callable $preFunction, callable $postFunction )

Create the edit mask.

Create the edit mask.

Parameters

$model
DcGeneral\Data\ModelInterface
$model The model with the current data.
$originalModel
DcGeneral\Data\ModelInterface
$originalModel The data from the original data.
$preFunction
callable
$preFunction The function to call before saving an item.
$postFunction
callable
$postFunction The function to call after saving an item.

Returns

string

Throws

DcGeneral\Exception\DcGeneralRuntimeException
If the data container is not editable, closed.
DcGeneral\Exception\DcGeneralInvalidArgumentException
If an unknown property is encountered in the palette.
protected string
# getLabelForShow( DcGeneral\DataDefinition\Definition\Properties\PropertyInterface $property )

Calculate the label of a property to se in "show" view.

Calculate the label of a property to se in "show" view.

Parameters

$property
DcGeneral\DataDefinition\Definition\Properties\PropertyInterface
$property The property for which the label shall be calculated.

Returns

string
public string
# show( )

Show Information about a model.

Show Information about a model.

Returns

string

Throws

DcGeneral\Exception\DcGeneralRuntimeException
When an unknown property is mentioned in the palette.

Implementation of

DcGeneral\View\ViewInterface::show()
public string
# showAll( )

Show all entries from one table.

Show all entries from one table.

Returns

string

Implementation of

DcGeneral\View\ViewInterface::showAll()
public string
# generateAjaxPalette( string $strSelector )

Generates a sub palette for the given selector (field name).

Generates a sub palette for the given selector (field name).

Parameters

$strSelector
string
$strSelector The name of the selector field.

Returns

string

Implementation of

DcGeneral\View\ViewInterface::generateAjaxPalette()
protected DcGeneral\DataDefinition\Definition\View\CommandInterface|null
# getCreateModelCommand( )

Create the "new" button.

Create the "new" button.

Returns

DcGeneral\DataDefinition\Definition\View\CommandInterface|null
protected DcGeneral\DataDefinition\Definition\View\CommandInterface|null
# getClearClipboardCommand( )

Create the "clear clipboard" button.

Create the "clear clipboard" button.

Returns

DcGeneral\DataDefinition\Definition\View\CommandInterface|null
protected DcGeneral\DataDefinition\Definition\View\CommandInterface|null
# getBackCommand( )

Create the "back" button.

Create the "back" button.

Returns

DcGeneral\DataDefinition\Definition\View\CommandInterface|null
protected string
# generateHeaderButton( DcGeneral\DataDefinition\Definition\View\CommandInterface $command )

Render a single header button.

Render a single header button.

Parameters

$command
DcGeneral\DataDefinition\Definition\View\CommandInterface
$command

Returns

string
protected string
# generateHeaderButtons( string $strButtonId )

Generate all buttons for the header of a view.

Generate all buttons for the header of a view.

Parameters

$strButtonId
string
$strButtonId The id for the surrounding html div element.

Returns

string
protected string
# buildCommand( DcGeneral\DataDefinition\Definition\View\CommandInterface $objCommand, DcGeneral\Data\ModelInterface $objModel, boolean $blnCircularReference, array $arrChildRecordIds, DcGeneral\Data\ModelInterface $previous, DcGeneral\Data\ModelInterface $next )

Render a command button.

Render a command button.

Parameters

$objCommand
DcGeneral\DataDefinition\Definition\View\CommandInterface
$objCommand The command to render the button for.
$objModel
DcGeneral\Data\ModelInterface
$objModel The model to which the command shall get applied.
$blnCircularReference
boolean
$blnCircularReference Determinator if there exists a circular reference between the model and the model(s) contained in the clipboard.
$arrChildRecordIds
array
$arrChildRecordIds List of the ids of all child models of the current model.
$previous
DcGeneral\Data\ModelInterface
$previous The previous model in the collection.
$next
DcGeneral\Data\ModelInterface
$next The next model in the collection.

Returns

string
public string
# renderPasteIntoButton( DcGeneral\Contao\View\Contao2BackendView\Event\GetPasteButtonEvent $event )

Render the paste into button.

Render the paste into button.

Parameters

$event
DcGeneral\Contao\View\Contao2BackendView\Event\GetPasteButtonEvent
$event The event that has been triggered.

Returns

string
public string
# renderPasteAfterButton( DcGeneral\Contao\View\Contao2BackendView\Event\GetPasteButtonEvent $event )

Render the paste after button.

Render the paste after button.

Parameters

$event
DcGeneral\Contao\View\Contao2BackendView\Event\GetPasteButtonEvent
$event The event that has been triggered.

Returns

string
protected string
# generateButtons( DcGeneral\Data\ModelInterface $model, DcGeneral\Data\ModelInterface $previous = null, DcGeneral\Data\ModelInterface $next = null )

Compile buttons from the table configuration array and return them as HTML.

Compile buttons from the table configuration array and return them as HTML.

Parameters

$model
DcGeneral\Data\ModelInterface
$model The model for which the buttons shall be generated for.
$previous
DcGeneral\Data\ModelInterface
$previous The previous model in the collection.
$next
DcGeneral\Data\ModelInterface
$next The next model in the collection.

Returns

string
protected string
# panel( )

Render the panel.

Render the panel.

Returns

string

Throws

DcGeneral\Exception\DcGeneralRuntimeException
When no panel has been defined.
protected string
# breadcrumb( )

Get the breadcrumb navigation via event.

Get the breadcrumb navigation via event.

Returns

string
public null|DcGeneral\Data\PropertyValueBag
# processInput( DcGeneral\Contao\View\Contao2BackendView\ContaoWidgetManager $widgetManager )

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

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

Parameters

$widgetManager
DcGeneral\Contao\View\Contao2BackendView\ContaoWidgetManager
$widgetManager The widget manager in use.

Returns

null|DcGeneral\Data\PropertyValueBag
public array
# formatModel( DcGeneral\Data\ModelInterface $model )

Format a model accordingly to the current configuration.

Format a model accordingly to the current configuration.

Returns either an array when in tree mode or a string in (parented) list mode.

Parameters

$model
DcGeneral\Data\ModelInterface
$model The model that shall be formatted.

Returns

array
public mixed
# getReadableFieldValue( DcGeneral\DataDefinition\Definition\Properties\PropertyInterface $property, DcGeneral\Data\ModelInterface $model, mixed $value )

Get for a field the readable value.

Get for a field the readable value.

Parameters

$property
DcGeneral\DataDefinition\Definition\Properties\PropertyInterface
$property The property to be rendered.
$model
DcGeneral\Data\ModelInterface
$model The model from which the property value shall be retrieved from.
$value
mixed
$value The value for the property.

Returns

mixed
Properties summary
protected string $notImplMsg '<div style="text-align:center; font-weight:bold; padding:40px;"> The function/view &quot;%s&quot; is not implemented. </div>'
#

The error message format string to use when a method is not implemented.

The error message format string to use when a method is not implemented.

protected DcGeneral\EnvironmentInterface $environment
#

The attached environment.

The attached environment.

protected DcGeneral\Panel\PanelContainerInterface $panel
#

The panel container in use.

The panel container in use.

contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0