eZPublish  3.8
eZTemplateNodeTool Class Reference

Various tool functions for working with template nodes. More...

Public Member Functions

 createAssignFromOutputVariableNode ($variableName, $parameters=array(), $assignmentType=EZ_PHPCREATOR_VARIABLE_ASSIGNMENT)
 
 createCodePieceElement ($codePiece, $values=false, $placement=false, $tmpValues=false, $knownTypes=true)
 
 createCodePieceNode ($codePiece, $parameters=array())
 
 createErrorNode ($text, $label, $placement=false, $parameters=array())
 
 createNamespaceChangeNode ($variableData, $parameters=array())
 
 createNamespaceRestoreNode ($parameters=array())
 
 createOutputVariableDecreaseNode ($parameters=array())
 
 createOutputVariableIncreaseNode ($parameters=array())
 
 createResourceAcquisitionNode ($resourceName, $templateName, $fileName, $method, $extraParameters, $placement=false, $parameters=array(), $newRootNamespace=false, $resourceVariableName=false)
 
 createSpacingDecreaseNode ($spacing=4, $parameters=array())
 
 createSpacingIncreaseNode ($spacing=4, $parameters=array())
 
 createTextNode ($text)
 
 createVariableUnsetNode ($variableName, $parameters=array())
 
 createWarningNode ($text, $label, $placement=false, $parameters=array())
 
 createWriteToOutputVariableNode ($variableName, $parameters=array(), $assignmentType=EZ_PHPCREATOR_VARIABLE_APPEND_TEXT)
 
 elementConstantValue ($elements)
 
 elementDynamicArray ($elements)
 
 elementDynamicArrayKeys ($elements)
 
 extractNodes ($nodeList, $parameters=array())
 
 eZTemplateNodeTool ()
 
 isArrayElement ($elements)
 
 isBooleanElement ($elements)
 
 isConstantElement ($elements)
 
 isIdentifierElement ($elements)
 
 isInternalCodePiece ($elements)
 
 isNumericElement ($elements)
 
 isPHPVariableElement ($elements)
 
 isStaticElement ($elements)
 
 isStringElement ($elements)
 
 isVariableElement ($elements)
 

Static Public Member Functions

 createArrayElement ($array, $variablePlacement=false)
 
 createAttributeLookupElement ($attributeValues=array(), $variablePlacement=false)
 
 createBooleanElement ($boolean, $variablePlacement=false)
 
 createConstantElement ($constant, $variablePlacement=false)
 
 createDynamicArrayElement (&$arrayKeys, &$arrayValues, $variablePlacement=false)
 
 createFunctionNodeHook (&$node, $hookName, $hookParameters=array(), $hookFunction=false)
 
 createIdentifierElement ($identifier, $variablePlacement=false)
 
 createNumericElement ($number, $variablePlacement=false)
 
 createOperatorElement ($name, $parameters=array(), $variablePlacement=false)
 
 createPHPVariableElement ($variableName, $variablePlacement=false)
 
 createStaticElement ($static, $variablePlacement=false)
 
 createStringElement ($string, $variablePlacement=false)
 
 createVariableElement ($variableName, $namespaceName, $namespaceScope=EZ_TEMPLATE_NAMESPACE_SCOPE_LOCAL, $variablePlacement=false)
 
 createVariableNode ($originalNode=false, $variableData=false, $variablePlacement=false, $parameters=array(), $variableAssignmentName=false, $onlyExisting=false, $overWrite=true, $assignFromVariable=false, $rememberSet=false)
 
 createVoidElement ()
 
 deflateFunctionNode (&$node, $preHook, $postHook)
 
 elementStaticValue ($elements)
 
 extractFunctionNodeChildren (&$node)
 
 extractFunctionNodeName (&$node)
 
 extractFunctionNodeParameterNames (&$node)
 
 extractFunctionNodeParameters (&$node)
 
 extractFunctionNodePlacement (&$node)
 
 extractOperatorNodeParameters (&$node)
 
 extractVariableNodeData (&$node)
 
 extractVariableNodePlacement (&$node)
 
 isDynamicArrayElement ($elements)
 
 removeFunctionNodeChildren (&$node)
 
 removeFunctionNodeParameters (&$node)
 
 removeFunctionNodePlacement (&$node)
 

Detailed Description

Various tool functions for working with template nodes.

Member Function Documentation

eZTemplateNodeTool::createArrayElement (   $array,
  $variablePlacement = false 
)
static
eZTemplateNodeTool::createAssignFromOutputVariableNode (   $variableName,
  $parameters = array(),
  $assignmentType = EZ_PHPCREATOR_VARIABLE_ASSIGNMENT 
)

Creates a new template node that will assign the content of the current output variable to the variable named $variableName.

The assignment type is by default variable assignment (=) and can be changed using $assignmentType.

Parameters
$parametersAn array with optional parameters, can contain the followin:
  • spacing - The number of spaces to added for each line this expression creates.

Referenced by eZTemplateCacheFunction\templateNodeTransformation(), and eZTemplateBlockFunction\templateNodeTransformation().

eZTemplateNodeTool::createAttributeLookupElement (   $attributeValues = array(),
  $variablePlacement = false 
)
static

Creates an element which does lookup on an attribute and returns it.

Parameters
$attributeValuesMust be an array with elements that result in scalar value or string.

Referenced by eZObjectForwarder\resourceAcquisitionTransformation(), and eZObjectForwarder\templateNodeTransformation().

eZTemplateNodeTool::createBooleanElement (   $boolean,
  $variablePlacement = false 
)
static
eZTemplateNodeTool::createCodePieceElement (   $codePiece,
  $values = false,
  $placement = false,
  $tmpValues = false,
  $knownTypes = true 
)

Referenced by eZTemplateArrayOperator\arrayTrans(), eZTemplateArithmeticOperator\basicTransformation(), eZTemplateArithmeticOperator\castTransformation(), eZTemplateLogicOperator\chooseTransformation(), eZTemplateArrayOperator\compareTrans(), eZTemplateTextOperator\concatTransformation(), eZTemplateControlOperator\condTransform(), eZTemplateLocaleOperator\currentDateTransformation(), eZTemplateStringOperator\customMapTransformation(), eZTemplateLocaleOperator\dateTimeTransformation(), eZTemplateArithmeticOperator\decIncTransformation(), eZTemplateArrayOperator\extractTrans(), eZTemplateExecuteOperator\fetchTransform(), eZTemplateLocaleOperator\getTimeTransformation(), eZTemplateDigestOperator\hashTransformation(), eZi18nOperator\i18nTrans(), eZTemplateTextOperator\indentTransformation(), eZURLOperator\iniTrans(), eZTemplateTypeOperator\isTransform(), eZTemplateLocaleOperator\l10nTransformation(), eZTemplateLogicOperator\logicalComparisonTransformation(), eZTemplateLocaleOperator\makeDateTimeTransformation(), eZTemplateArrayOperator\mergeTrans(), eZTemplateArithmeticOperator\minMaxTransformation(), eZTemplateArithmeticOperator\modTransformation(), eZTemplateLogicOperator\negateTransformation(), eZTemplateNl2BrOperator\nl2brTransformation(), eZTemplateUnitOperator\operatorTransform(), eZTemplateStringOperator\phpMapTransformation(), eZTemplatePHPOperator\phpOperatorTransformation(), eZKernelOperator\preferencesTransformation(), eZTemplateArithmeticOperator\randTransformation(), eZTemplateArithmeticOperator\roundTransformation(), eZURLOperator\urlTransformation(), and eZTemplateStringOperator\washTransformation().

eZTemplateNodeTool::createConstantElement (   $constant,
  $variablePlacement = false 
)
static

Creates an element which represents the static value and returns it, the type of the variable determines the type of the element.

eZTemplateNodeTool::createDynamicArrayElement ( $arrayKeys,
$arrayValues,
  $variablePlacement = false 
)
static

Creates an element which represents an array and returns it.

Parameters
arraykey list, static.
arrayvalues as php code.
values.

Referenced by eZTemplateArrayOperator\arrayTrans().

eZTemplateNodeTool::createErrorNode (   $text,
  $label,
  $placement = false,
  $parameters = array() 
)
eZTemplateNodeTool::createFunctionNodeHook ( $node,
  $hookName,
  $hookParameters = array(),
  $hookFunction = false 
)
static

Creates a new function node hook with name $hookName and optional parameters $hookParameters and function data $hookFunction and returns it.

Referenced by deflateFunctionNode().

eZTemplateNodeTool::createIdentifierElement (   $identifier,
  $variablePlacement = false 
)
static

Creates an element which represents an identifier and returns it.

eZTemplateNodeTool::createNamespaceChangeNode (   $variableData,
  $parameters = array() 
)
eZTemplateNodeTool::createOperatorElement (   $name,
  $parameters = array(),
  $variablePlacement = false 
)
static

Creates an element which represents an operator and returns it.

Parameters
$nameThe name of the operator to run.
$parametersAn array with parameters, each parameter is an array of variable elements.
eZTemplateNodeTool::createOutputVariableDecreaseNode (   $parameters = array())
eZTemplateNodeTool::createOutputVariableIncreaseNode (   $parameters = array())
eZTemplateNodeTool::createPHPVariableElement (   $variableName,
  $variablePlacement = false 
)
static

Creates an element which represents an array and returns it.

eZTemplateNodeTool::createResourceAcquisitionNode (   $resourceName,
  $templateName,
  $fileName,
  $method,
  $extraParameters,
  $placement = false,
  $parameters = array(),
  $newRootNamespace = false,
  $resourceVariableName = false 
)
eZTemplateNodeTool::createStaticElement (   $static,
  $variablePlacement = false 
)
static
eZTemplateNodeTool::createVariableElement (   $variableName,
  $namespaceName,
  $namespaceScope = EZ_TEMPLATE_NAMESPACE_SCOPE_LOCAL,
  $variablePlacement = false 
)
static

Creates an element which represents an variable lookup and returns it.

Parameters
$namespaceScopeType of variable lookup, can be one of:
  • EZ_TEMPLATE_NAMESPACE_SCOPE_GLOBAL, Look for variables at the very top of the namespace tree
  • EZ_TEMPLATE_NAMESPACE_SCOPE_LOCAL, Look for variables at the top of the current file being processed
  • EZ_TEMPLATE_NAMESPACE_SCOPE_RELATIVE, Look for variables from the current namespace

Referenced by eZObjectForwarder\resourceAcquisitionTransformation(), eZObjectForwarder\templateNodeTransformation(), and eZTemplateBlockFunction\templateNodeTransformation().

eZTemplateNodeTool::createVariableNode (   $originalNode = false,
  $variableData = false,
  $variablePlacement = false,
  $parameters = array(),
  $variableAssignmentName = false,
  $onlyExisting = false,
  $overWrite = true,
  $assignFromVariable = false,
  $rememberSet = false 
)
static
eZTemplateNodeTool::createVoidElement ( )
static

Creates an element which represents nothing (void).

Referenced by createConstantElement(), and createStaticElement().

eZTemplateNodeTool::createWarningNode (   $text,
  $label,
  $placement = false,
  $parameters = array() 
)
eZTemplateNodeTool::createWriteToOutputVariableNode (   $variableName,
  $parameters = array(),
  $assignmentType = EZ_PHPCREATOR_VARIABLE_APPEND_TEXT 
)

Creates a new template node that will assign the content of the current output variable to the variable named $variableName.

The assignment type is by default text concat (.) and can be changed using $assignmentType.

Parameters
$parametersAn array with optional parameters, can contain the followin:
  • spacing - The number of spaces to added for each line this expression creates.

Referenced by eZTemplateCacheFunction\templateNodeTransformation().

eZTemplateNodeTool::deflateFunctionNode ( $node,
  $preHook,
  $postHook 
)
static

Creates a pre and post hook for the function node $node with the children in between the nodes. This means that a nested function node will be deflated to a pre/children/post list.

eZTemplateNodeTool::elementConstantValue (   $elements)
Returns
The value of the constant element or null if the element is not constant.
Note
Make sure the element is checked with isConstantElement() before running this.
Can also be used on PHP variable elements, it will then fetch the variable name.

Referenced by eZTemplateDebugFunction\templateNodeTransformation().

eZTemplateNodeTool::elementDynamicArray (   $elements)
Returns
assosiative array of parameters in Dynamic Array

Referenced by eZTemplateExecuteOperator\fetchTransform().

eZTemplateNodeTool::elementDynamicArrayKeys (   $elements)
Returns
the array keys of the Dynamic array

Referenced by eZTemplateExecuteOperator\fetchTransform().

eZTemplateNodeTool::elementStaticValue (   $elements)
static
Deprecated:
Use elementConstantValue instead.

Referenced by eZURLOperator\applyQuotes(), eZTemplateArrayOperator\arrayTrans(), eZTemplateArithmeticOperator\basicTransformation(), eZTemplateArithmeticOperator\castTransformation(), eZTemplateLogicOperator\chooseTransformation(), eZTemplateArrayOperator\compareTrans(), eZTemplateTextOperator\concatTransformation(), eZTemplateControlOperator\condTransform(), eZTemplateStringOperator\customMapTransformation(), eZTemplateLocaleOperator\dateTimeTransformation(), eZTemplateArithmeticOperator\decIncTransformation(), eZTemplateArrayOperator\extractTrans(), eZTemplateExecuteOperator\fetchTransform(), eZTemplateCompiler\generateVariableDataCode(), eZi18nOperator\i18nTrans(), eZTemplateTextOperator\indentTransformation(), eZURLOperator\iniTrans(), eZTemplateLocaleOperator\l10nTransformation(), eZTemplateLogicOperator\logicalComparisonTransformation(), eZTemplateArrayOperator\mergeTrans(), eZTemplateArithmeticOperator\minMaxTransformation(), eZTemplateArithmeticOperator\modTransformation(), eZTemplateUnitOperator\operatorTransform(), eZTemplateStringOperator\phpMapTransformation(), eZKernelOperator\preferencesTransformation(), eZTemplateCompiledLoop\processChildren(), eZTemplateArithmeticOperator\romanTransformation(), eZTemplateArithmeticOperator\roundTransformation(), eZTemplateSwitchFunction\templateNodeCaseTransformation(), eZTemplateCacheFunction\templateNodeTransformation(), eZObjectForwarder\templateNodeTransformation(), eZTemplateMenuFunction\templateNodeTransformation(), eZTemplateToolbarFunction\templateNodeTransformation(), eZTemplateIncludeFunction\templateNodeTransformation(), eZTemplateSequenceFunction\templateNodeTransformation(), eZTemplateBlockFunction\templateNodeTransformation(), eZTemplateSwitchFunction\templateNodeTransformation(), eZTemplateSetFunction\templateNodeTransformation(), eZTemplateSectionFunction\templateNodeTransformation(), eZURLOperator\urlTransformation(), and eZTemplateStringOperator\washTransformation().

eZTemplateNodeTool::extractFunctionNodeName ( $node)
static
Returns
the name of the function for the function node $node.

Referenced by eZTemplateSectionFunction\templateNodeTransformation().

eZTemplateNodeTool::extractFunctionNodeParameterNames ( $node)
static
Returns
the parameters of the function node $node.
eZTemplateNodeTool::extractNodes (   $nodeList,
  $parameters = array() 
)
eZTemplateNodeTool::extractOperatorNodeParameters ( $node)
static
Returns
the parameters for the operator node $node.
eZTemplateNodeTool::extractVariableNodeData ( $node)
static
Returns
the variable data from the variable node $node.
eZTemplateNodeTool::extractVariableNodePlacement ( $node)
static
Returns
the variable placement from the variable node $node.

Referenced by eZTemplateLogicOperator\chooseTransformation().

eZTemplateNodeTool::eZTemplateNodeTool ( )

Constructor

eZTemplateNodeTool::isArrayElement (   $elements)
Returns
true if the element list $elements is considered to be an array. It is considered constant if the following is true:
  • The start value is array
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
eZTemplateNodeTool::isBooleanElement (   $elements)
Returns
true if the element list $elements is considered to be a boolean. It is considered constant if the following is true:
  • The start value is boolean
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure booleans use isConstantElement instead and just use the element value as boolean value.
eZTemplateNodeTool::isConstantElement (   $elements)
Returns
true if the element list $elements is considered to have a constant value. It is considered constant if the following is true:
  • The start value is either numeric, text, identifier, array or boolean
  • It has no operators
  • It has no attribute lookup

Referenced by elementConstantValue(), elementStaticValue(), eZi18nOperator\i18nTrans(), and eZTemplateDebugFunction\templateNodeTransformation().

eZTemplateNodeTool::isDynamicArrayElement (   $elements)
static

Check if element id Dynamic Array

Referenced by elementDynamicArray(), elementDynamicArrayKeys(), and eZTemplateExecuteOperator\fetchTransform().

eZTemplateNodeTool::isIdentifierElement (   $elements)
Returns
true if the element list $elements is considered to be an identifier. It is considered constant if the following is true:
  • The start value is identifier
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure identifiers use isStringElement or isConstantElement instead.
eZTemplateNodeTool::isInternalCodePiece (   $elements)
Returns
true if the element list $elements is considered to be an internal code piece.

Referenced by eZTemplateExecuteOperator\fetchTransform().

eZTemplateNodeTool::isNumericElement (   $elements)
Returns
true if the element list $elements is considered to be numerical. It is considered constant if the following is true:
  • The start value is numeric (integer or float)
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure integers or floats use isConstantElement instead and just use the element value as numerical value.
eZTemplateNodeTool::isPHPVariableElement (   $elements)
Returns
true if the element list $elements is considered to have a PHP variable element. The following must be true.
  • The start value is PHP variable
  • It has no operators
  • It has no attribute lookup

Referenced by elementConstantValue(), and elementStaticValue().

eZTemplateNodeTool::isStaticElement (   $elements)
Deprecated:
Use isConstantElement instead.

Referenced by eZTemplateArrayOperator\arrayTrans(), eZTemplateArithmeticOperator\basicTransformation(), eZTemplateArithmeticOperator\castTransformation(), eZTemplateLogicOperator\chooseTransformation(), eZTemplateArrayOperator\compareTrans(), eZTemplateTextOperator\concatTransformation(), eZTemplateControlOperator\condTransform(), eZTemplateStringOperator\customMapTransformation(), eZTemplateLocaleOperator\dateTimeTransformation(), eZTemplateArithmeticOperator\decIncTransformation(), eZTemplateArrayOperator\extractTrans(), eZTemplateExecuteOperator\fetchTransform(), eZTemplateCompiler\generateVariableDataCode(), eZTemplateTextOperator\indentTransformation(), eZURLOperator\iniTrans(), eZTemplateLocaleOperator\l10nTransformation(), eZTemplateLogicOperator\logicalComparisonTransformation(), eZTemplateArrayOperator\mergeTrans(), eZTemplateArithmeticOperator\minMaxTransformation(), eZTemplateArithmeticOperator\modTransformation(), eZTemplateUnitOperator\operatorTransform(), eZTemplateStringOperator\phpMapTransformation(), eZKernelOperator\preferencesTransformation(), eZTemplateCompiledLoop\processChildren(), eZTemplateArithmeticOperator\romanTransformation(), eZTemplateArithmeticOperator\roundTransformation(), eZTemplateSwitchFunction\templateNodeCaseTransformation(), eZObjectForwarder\templateNodeTransformation(), eZTemplateCacheFunction\templateNodeTransformation(), eZTemplateMenuFunction\templateNodeTransformation(), eZTemplateToolbarFunction\templateNodeTransformation(), eZTemplateIncludeFunction\templateNodeTransformation(), eZTemplateSequenceFunction\templateNodeTransformation(), eZTemplateBlockFunction\templateNodeTransformation(), eZTemplateSwitchFunction\templateNodeTransformation(), eZTemplateSetFunction\templateNodeTransformation(), eZTemplateSectionFunction\templateNodeTransformation(), eZURLOperator\urlTransformation(), and eZTemplateStringOperator\washTransformation().

eZTemplateNodeTool::isStringElement (   $elements)
Returns
true if the element list $elements is considered to be a string. It is considered constant if the following is true:
  • The start value is string or identifier
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure strings use isConstantElement instead and just use the element value as string value.
eZTemplateNodeTool::isVariableElement (   $elements)
Returns
true if the element list $elements is considered to be a variable element.

Referenced by eZTemplateExecuteOperator\fetchTransform().

eZTemplateNodeTool::removeFunctionNodeChildren ( $node)
static

Removes the children from the function node $node.

Referenced by deflateFunctionNode().

eZTemplateNodeTool::removeFunctionNodeParameters ( $node)
static

Removes the parameters from the function node $node.

Referenced by deflateFunctionNode().

eZTemplateNodeTool::removeFunctionNodePlacement ( $node)
static

Removes the placement info from the function node $node.


The documentation for this class was generated from the following file: