TYPO3  7.6
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TemplateVariableContainer Class Reference
Inheritance diagram for TemplateVariableContainer:

Public Member Functions

 __construct (array $variableArray=array())
 
 add ($identifier, $value)
 
 get ($identifier)
 
 remove ($identifier)
 
 getAllIdentifiers ()
 
 getAll ()
 
 exists ($identifier)
 
 __sleep ()
 
 offsetSet ($identifier, $value)
 
 offsetUnset ($identifier)
 
 offsetExists ($identifier)
 
 offsetGet ($identifier)
 
 getOrNull ($variableName)
 

Protected Attributes

 $variables = array()
 

Static Protected Attributes

static $reservedVariableNames = array('true', 'false', 'on', 'off', 'yes', 'no', '_all')
 

Detailed Description

VariableContainer which stores template variables. Is used in two contexts:

1) Holds the current variables in the template 2) Holds variables being set during Parsing (set in view helpers implementing the PostParse facet)

Definition at line 23 of file TemplateVariableContainer.php.

Constructor & Destructor Documentation

__construct ( array  $variableArray = array())

Constructor. Can take an array, and initializes the variables with it.

Parameters
array$variableArray

Definition at line 45 of file TemplateVariableContainer.php.

Member Function Documentation

__sleep ( )

Clean up for serializing.

Returns
array

Definition at line 148 of file TemplateVariableContainer.php.

add (   $identifier,
  $value 
)

Add a variable to the context

Parameters
string$identifierIdentifier of the variable to add
mixed$valueThe variable's value
Returns
void
Exceptions
Exception\InvalidVariableException

Definition at line 59 of file TemplateVariableContainer.php.

Referenced by TemplateVariableContainer\offsetSet().

exists (   $identifier)

Checks if this property exists in the VariableContainer.

Parameters
string$identifier
Returns
bool TRUE if $identifier exists, FALSE otherwise

Definition at line 134 of file TemplateVariableContainer.php.

Referenced by TemplateVariableContainer\offsetExists().

get (   $identifier)

Get a variable from the context. Throws exception if variable is not found in context.

If "_all" is given as identifier, all variables are returned in an array.

Parameters
string$identifier
Returns
mixed The variable value identified by $identifier
Exceptions
Exception\InvalidVariableException

Definition at line 80 of file TemplateVariableContainer.php.

References TemplateVariableContainer\$variables.

getAll ( )

Returns the variables array.

Returns
array Identifiers and values of all variables

Definition at line 122 of file TemplateVariableContainer.php.

References TemplateVariableContainer\$variables.

getAllIdentifiers ( )

Returns an array of all identifiers available in the context.

Returns
array Array of identifier strings

Definition at line 112 of file TemplateVariableContainer.php.

getOrNull (   $variableName)

Gets a variable or NULL if it does not exist

Parameters
string$variableNamename of the variable
Returns
mixed the stored variable or NULL

Definition at line 205 of file TemplateVariableContainer.php.

References TemplateVariableContainer\$variables.

offsetExists (   $identifier)

Checks if this property exists in the VariableContainer.

Parameters
string$identifier
Returns
bool TRUE if $identifier exists, FALSE otherwise

Definition at line 182 of file TemplateVariableContainer.php.

References TemplateVariableContainer\exists().

offsetGet (   $identifier)

Get a variable from the context. Throws exception if variable is not found in context.

Parameters
string$identifier
Returns
mixed The variable identified by $identifier

Definition at line 193 of file TemplateVariableContainer.php.

offsetSet (   $identifier,
  $value 
)

Adds a variable to the context.

Parameters
string$identifierIdentifier of the variable to add
mixed$valueThe variable's value
Returns
void

Definition at line 160 of file TemplateVariableContainer.php.

References TemplateVariableContainer\add().

offsetUnset (   $identifier)

Remove a variable from context. Throws exception if variable is not found in context.

Parameters
string$identifierThe identifier to remove
Returns
void

Definition at line 171 of file TemplateVariableContainer.php.

remove (   $identifier)

Remove a variable from context. Throws exception if variable is not found in context.

Parameters
string$identifierThe identifier to remove
Returns
void
Exceptions
Exception\InvalidVariableException

Definition at line 99 of file TemplateVariableContainer.php.

Member Data Documentation

$reservedVariableNames = array('true', 'false', 'on', 'off', 'yes', 'no', '_all')
staticprotected

Definition at line 30 of file TemplateVariableContainer.php.

$variables = array()
protected