|
eZ Publish
[trunk]
|
Display of variable attributes using operator "attribute" or dumps a variable using the operator "dump". More...
Public Member Functions | |
| eZTemplateAttributeOperator ($attributeName= 'attribute', $dumpName= 'dump') | |
| modify ($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement) | |
| namedParameterList () | |
| namedParameterPerOperator () | |
| operatorList () | |
| operatorTemplateHints () | |
Public Attributes | |
| $Operators | |
| The array of operators, used for registering operators. | |
Private Member Functions | |
| displayVariable (&$value, ezpAttributeOperatorFormatterInterface $formatter, $showValues, $max, $level, &$outputString) | |
Display of variable attributes using operator "attribute" or dumps a variable using the operator "dump".
This class allows for displaying template variable attributes. The display is recursive and the number of levels can be maximized.
The "attribute" operator can take three parameters. The first is whether to show variable values or not, default is to not show. The second is the maximum number of levels to recurse, if blank or omitted the maxium level is 2. The third is the type of display, if set to "text" the output is as pure text otherwise as html. The default output is configured in template.ini.
The "dump" operator does exactly what the "attribute" operator does with following exceptions:
// Example template code for operator 'attribute' // Display attributes of $myvar {$myvar|attribute} // Display 2 levels of $tree {$tree|attribute(show,2)} // Display attributes and values of $item {$item|attribute(show)} // Example template code for operator 'dump' // Dumps out $myvar - can handle primitive variables, arrays and objects. // By default it shows array values or object properties. {$myvar|dump()} // Show 2 levels of $tree (default is 1) {$tree|dump(show, 2)}
Definition at line 55 of file eztemplateattributeoperator.php.
| eZTemplateAttributeOperator::displayVariable | ( | &$ | value, |
| ezpAttributeOperatorFormatterInterface $ | formatter, | ||
| $ | showValues, | ||
| $ | max, | ||
| $ | level, | ||
| &$ | outputString | ||
| ) | [private] |
Helper function for recursive display of attributes. $value is the current variable, $as_html is true if display as html, $max is the maximum number of levels, $cur_level the current level and $outputString is the output text which the function adds to.
Definition at line 152 of file eztemplateattributeoperator.php.
Referenced by modify().
| eZTemplateAttributeOperator::eZTemplateAttributeOperator | ( | $ | attributeName = 'attribute', |
| $ | dumpName = 'dump' |
||
| ) |
Initializes the object with the name $attributeName, default is "attribute" and $dumpName, default is 'dump'
Definition at line 60 of file eztemplateattributeoperator.php.
| eZTemplateAttributeOperator::modify | ( | $ | tpl, |
| $ | operatorName, | ||
| $ | operatorParameters, | ||
| $ | rootNamespace, | ||
| $ | currentNamespace, | ||
| &$ | operatorValue, | ||
| $ | namedParameters, | ||
| $ | placement | ||
| ) |
Display the variable.
Definition at line 122 of file eztemplateattributeoperator.php.
See eZTemplateOperator::namedParameterList()
Definition at line 89 of file eztemplateattributeoperator.php.
Definition at line 114 of file eztemplateattributeoperator.php.
Returns the template operators.
Definition at line 71 of file eztemplateattributeoperator.php.
Definition at line 76 of file eztemplateattributeoperator.php.
| eZTemplateAttributeOperator::$Operators |
The array of operators, used for registering operators.
Definition at line 184 of file eztemplateattributeoperator.php.