Wrapper class for tree node states.

This class encapsulates the open/closed states for a tree of models.

 Methods

Create a new instance.

__construct(array $states, array $implicitOpen) 

Parameters

$states

array

The initial state array (optional, if not given, the state information will be empty).

$implicitOpen

array

List of implicit open nodes (selected values, if not given, the state information will be empty).

Retrieve the list of implicit open nodes.

getImplicitOpen() : array
The returned array may be stored to session or other persistent storage and imported again via constructor argument or a call to setStates().

Returns

array

Retrieve the states as array.

getStates() : array
The returned array may be stored to session or other persistent storage and imported again via constructor argument or a call to setStates().
see

Returns

array

Retrieve the flag if all nodes shall be shown in "open" state.

isAllOpen() : boolean

Returns

boolean

Determine if the model is expanded.

isModelOpen(string $providerName, mixed $modelId, bool $ignoreAllState) : bool

Parameters

$providerName

string

The data provider name.

$modelId

mixed

The id of the model.

$ignoreAllState

bool

If this is true, the "all open" flag will be ignored.

Returns

bool

This will reset all the information and therefore close all models.

resetAll() : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates

Set the flag if all elements shall be expanded or not.

setAllOpen(boolean $allOpen) : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates
If this flag is set, all tree nodes will be handled in "open" state - if this flag is not set, the visibility states will get read from the open flags per driver.

Parameters

$allOpen

boolean

The flag.

Returns

Set the list of implicit open nodes.

setImplicitOpen(array $implicitOpen) : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates

Parameters

$implicitOpen

array

The state array.

Returns

Toggle the model with the given id from the given provider.

setModelState(string $providerName, mixed $modelId, bool $state) : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates

Parameters

$providerName

string

The data provider name.

$modelId

mixed

The id of the model.

$state

bool

The new state for the model.

Returns

Set the native states.

setStates(array $states) : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates
The states must be created via the getStates() method.
see

Parameters

$states

array

The state array.

Returns

Toggle the model with the given id from the given provider.

toggleModel(string $providerName, mixed $modelId) : \ContaoCommunityAlliance\DcGeneral\Controller\TreeNodeStates

Parameters

$providerName

string

The data provider name.

$modelId

mixed

The id of the model.

Returns

 Properties

 

List of implicit open nodes (selected values i.e.).

$implicitOpen : array
 

The states of the nodes.

$states : array