Provide methods to handle input field "tableTree".

 Methods

Create a new instance.

__construct(array $attributes, \ContaoCommunityAlliance\DcGeneral\DC_General $dataContainer) 

Parameters

$attributes

array

The custom attributes.

$dataContainer

\ContaoCommunityAlliance\DcGeneral\DC_General

The data container.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When not in Backend mode.

Return an object property.

__get(string $strKey) : string
Supported keys: * sourceName: the name of the data container for the item elements. * fieldType : the input type. Either "radio" or "checkbox". * titleIcon: the icon to use in the title section. * mandatory: the field value must not be empty.

Parameters

$strKey

string

The property name.

Returns

stringThe property value.

Add specific attributes.

__set(string $strKey, mixed $varValue) : void

Parameters

$strKey

string

The key to set.

$varValue

mixed

The value.

Exceptions

\RuntimeException When an unknown field type is encountered.

Format a model accordingly to the current configuration.

formatModel(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model, bool $treeMode) : array
Returns either an array when in tree mode or a string in (parented) list mode.

Parameters

$model

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model that shall be formatted.

$treeMode

bool

Flag if we are running in tree mode or not (optional, default: true).

Returns

array

Generate the widget and return it as string.

generate() : string
SuppressWarnings (PHPMD.Superglobals)
SuppressWarnings (PHPMD.CamelCaseVariableName)

Returns

string

Generate a particular sub part of the page tree and return it as HTML string.

generateAjax() : void
SuppressWarnings (PHPMD.ExitExpression)

Generate when being called from within a popup.

generatePopup() : string
SuppressWarnings (PHPMD.Superglobals)
SuppressWarnings (PHPMD.CamelCaseVariableName)

Returns

string

Retrieve the environment of the item data container.

getEnvironment() : \ContaoCommunityAlliance\DcGeneral\EnvironmentInterface

Retrieve the item container.

getItemContainer() : \ContaoCommunityAlliance\DcGeneral\DC_General

Retrieve the id for this view.

getSearchSessionKey() : string

Returns

string

Recursively retrieve a collection of all complete node hierarchy.

getTreeCollectionRecursive(array $rootId, int $intLevel, string $providerName) : \ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

Parameters

$rootId

array

The ids of the root node.

$intLevel

int

The level the items are residing on.

$providerName

string

The data provider from which the root element originates from.

Returns

Check if an custom sorting field has been defined.

isSearchAvailable() : bool

Returns

bool

Load the collection of child items and the parent item for the currently selected parent item.

loadCollection(mixed $rootId, int $intLevel, null $providerName) : \ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

Parameters

$rootId

mixed

The root element (or null to fetch everything).

$intLevel

int

The current level in the tree (of the optional root element).

$providerName

null

The data provider from which the optional root element shall be taken from.

Returns

Render the current values for listing.

renderItemsPlain() : array

Returns

array

Update the value via ajax and redraw the widget.

updateAjax(string $ajaxAction, \ContaoCommunityAlliance\DcGeneral\DC_General $dataContainer) : string
SuppressWarnings (PHPMD.Superglobals)
SuppressWarnings (PHPMD.CamelCaseVariableName)
SuppressWarnings (PHPMD.ExitExpression)

Parameters

$ajaxAction

string

Not used in here.

$dataContainer

\ContaoCommunityAlliance\DcGeneral\DC_General

The data container to use.

Returns

string

Check the state of a model and set the metadata accordingly.

determineModelState(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model, int $level) : void

Parameters

$model

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model of which the state shall be checked of.

$level

int

The tree level the model is contained within.

Generate the tree view for a given collection.

generateTreeView(\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $objCollection, string $treeClass) : string

Parameters

$objCollection

\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

The collection to iterate over.

$treeClass

string

The class to use for the tree.

Returns

string

Retrieve the formatter for the given model.

getFormatter(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model, bool $treeMode) : \ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\ModelFormatterConfigInterface

Parameters

$model

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model for which the formatter shall be retrieved.

$treeMode

bool

Flag if we are running in tree mode or not.

Returns

Retrieve the id for this view.

getToggleId() : string

Returns

string

Render a given model.

parseModel(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel, string $strToggleID) : string

Parameters

$strToggleID

string

The id of the toggler.

Returns

string

Setup all local values and create the dc instance for the referenced data source.

setUp(\ContaoCommunityAlliance\DcGeneral\DC_General $dataContainer) : void

Parameters

$dataContainer

\ContaoCommunityAlliance\DcGeneral\DC_General

The data container to use.

This "renders" a model for tree view.

treeWalkModel(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel, int $intLevel, array $arrSubTables) : void

Parameters

$intLevel

int

The current level in the tree hierarchy.

$arrSubTables

array

The names of data providers that shall be rendered "below" this item.

Skip the field if "change selection" is not checked.

validator(array $varInput) : array | string

Parameters

$varInput

array

The current value.

Returns

arraystring

Convert the value according to the configured fieldtype.

convertValue(mixed $varValue) : mixed

Parameters

$varValue

mixed

The value to convert.

Exceptions

\RuntimeException When an unknown field type is encountered.

Returns

mixed

Determine all parents of all selected values.

determineParentsOfValues() : array

Returns

array

Determine the root ids.

getRootIds() : array

Returns

array

Fetch all parents of the passed model.

parentsOf(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $value, string[] $parents) : void

Parameters

$parents

string[]

The ids of all detected parents so far.

Sort the passed value array by the defined order field (if defined).

sortValues(array $values) : array

Parameters

$values

array

The values.

Returns

array

 Properties

 

Flag determining if the value shall always be saved.

$alwaysSave : bool
 

Submit user input.

$blnSubmitInput : boolean
 

The data Container.

$dataContainer : \ContaoCommunityAlliance\DcGeneral\DC_General
 

The field type to use.

$fieldType : string
This may be either "radio" or "checkbox"
 

The data container for the item source.

$itemContainer : \ContaoCommunityAlliance\DcGeneral\DC_General
 

The maximum level for items to be selectable.

$maxLevel : int
 

The minimum level for items to be selectable.

$minLevel : int
 

The tree nodes to be handled.

$nodeStates : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates
 

The property used for ordering.

$orderField : string
 

The source data container name.

$sourceName : string
 

The ajax id.

$strAjaxId : string
 

The ajax key.

$strAjaxKey : string
 

The ajax name.

$strAjaxName : string
 

The template.

$strTemplate : string
 

The sub template to use when generating.

$subTemplate : string
 

The title to display.

$title : string
 

The icon to use in the title section.

$titleIcon : string