Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | List of all members
eZTemplateUnitOperator Class Reference
Template system » Template operators

Handles unit conversion and display using the operator "si". More...

## Public Member Functions
| __construct ( $name="si")
| operatorList ()
| operatorTemplateHints ()
| operatorTransform ( $operatorName, &$node, $tpl, &$resourceData, $element, $lastElement, $elementList, $elementTree, &$parameters)
| namedParameterList ()
| modify ( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)

## Public Attributes
| $SIName
| $Operators

## Detailed Description

Handles unit conversion and display using the operator "si".

The operator reads two parameters. The first tells the kind of unit type we're dealing with, for instance: byte, length. The second determines the behaviour of prefixes and is optional.

The available units are defined in the settings/unit.ini file. The bases are read from the Base group.

The unit operator supports both traditional 10^n based prefixes as well as binary prefixes(2^n n=10,20..), both old names and new names. See International Systems of Units

// Example of template code
{1025|si(byte)}
{1025|si(byte,binary)}
{1025|si(byte,decimal)}
{1025|si(byte,none)}
{1025|si(byte,auto)}
{1025|si(byte,mebi)}

Definition at line 38 of file eztemplateunitoperator.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTemplateUnitOperator::__construct | ( |  | $name = `"si"` | ) |

Initializes the operator with the name $name, default is "si"

Parameters

  string | $name |

Definition at line 47 of file eztemplateunitoperator.php.

## Member Function Documentation

## ◆ modify()

eZTemplateUnitOperator::modify | ( |  | $tpl,
|  |  | $operatorName,
|  |  | $operatorParameters,
|  |  | $rootNamespace,
|  |  | $currentNamespace,
|  | & | $operatorValue,
|  |  | $namedParameters,
|  |  | $placement
| ) |  |

Performs unit conversion.

Definition at line 366 of file eztemplateunitoperator.php.

References eZLocale\instance().

## ◆ namedParameterList()

eZTemplateUnitOperator::namedParameterList | ( |  | ) |

See eZTemplateOperator::namedParameterList

Definition at line 344 of file eztemplateunitoperator.php.

## ◆ operatorList()

eZTemplateUnitOperator::operatorList | ( |  | ) |

Returns the operators in this class.

Definition at line 56 of file eztemplateunitoperator.php.

References $Operators.

## ◆ operatorTemplateHints()

eZTemplateUnitOperator::operatorTemplateHints | ( |  | ) |

Definition at line 61 of file eztemplateunitoperator.php.

## ◆ operatorTransform()

eZTemplateUnitOperator::operatorTransform | ( |  | $operatorName,
|  | & | $node,
|  |  | $tpl,
|  | & | $resourceData,
|  |  | $element,
|  |  | $lastElement,
|  |  | $elementList,
|  |  | $elementTree,
|  | & | $parameters
| ) |  |

Definition at line 72 of file eztemplateunitoperator.php.

References eZTemplateNodeTool\createArrayElement(), eZTemplateNodeTool\createCodePieceElement(), eZTemplateNodeTool\createNumericElement(), eZTemplateNodeTool\createStringElement(), eZTemplateNodeTool\elementConstantValue(), eZLocale\instance(), and eZTemplateNodeTool\isConstantElement().

## Member Data Documentation

## ◆ $Operators

eZTemplateUnitOperator::$Operators

Definition at line 41 of file eztemplateunitoperator.php.

Referenced by operatorList().

## ◆ $SIName

eZTemplateUnitOperator::$SIName

Definition at line 40 of file eztemplateunitoperator.php.

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

- eztemplateunitoperator.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.