本文整理匯總了PHP中eZTemplateCompiler::processElementTransformationChild方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZTemplateCompiler::processElementTransformationChild方法的具體用法?PHP eZTemplateCompiler::processElementTransformationChild怎麽用?PHP eZTemplateCompiler::processElementTransformationChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZTemplateCompiler
的用法示例。
在下文中一共展示了eZTemplateCompiler::processElementTransformationChild方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processElementTransformationChild
static function processElementTransformationChild($useComments, $php, $tpl, &$node, $elementTree, $elementList, &$resourceData)
{
$count = count($elementList);
$lastElement = null;
$newElementList = array();
for ($i = 0; $i < $count; ++$i) {
$element =& $elementList[$i];
$elementType = $element[0];
if ($elementType == eZTemplate::TYPE_OPERATOR) {
$operatorName = $element[1][0];
$operatorParameters = array_slice($element[1], 1);
if (!isset($tpl->Operators[$operatorName])) {
return false;
}
if (is_array($tpl->Operators[$operatorName])) {
$tpl->loadAndRegisterOperators($tpl->Operators[$operatorName]);
}
$operatorObject =& $tpl->Operators[$operatorName];
if (is_object($operatorObject)) {
$hasTransformationSupport = false;
$transformParameters = false;
$inputAsParameter = false;
$knownType = 'static';
if (method_exists($operatorObject, 'operatorTemplateHints')) {
$hints = $operatorObject->operatorTemplateHints();
if (isset($hints[$operatorName]) and isset($hints[$operatorName]['element-transformation']) and $hints[$operatorName]['element-transformation']) {
$hasTransformationSupport = true;
}
if ($hasTransformationSupport and isset($hints[$operatorName]['element-transformation-func'])) {
$transformationMethod = $hints[$operatorName]['element-transformation-func'];
} else {
$transformationMethod = 'templateElementTransformation';
}
if (isset($hints[$operatorName]) and isset($hints[$operatorName]['transform-parameters'])) {
$transformParameters = $hints[$operatorName]['transform-parameters'];
}
if (isset($hints[$operatorName]) and isset($hints[$operatorName]['input-as-parameter'])) {
$inputAsParameter = $hints[$operatorName]['input-as-parameter'];
}
if (isset($hints[$operatorName]['output']) and !$hints[$operatorName]['output']) {
$knownType = 'null';
} else {
if (isset($hints[$operatorName]['output-type'])) {
$knownType = $hints[$operatorName]['output-type'];
}
}
}
if ($hasTransformationSupport and method_exists($operatorObject, $transformationMethod)) {
$resetNewElementList = false;
if ($transformParameters) {
$newParameters = array();
if ($inputAsParameter) {
$newParameterElements = eZTemplateCompiler::processElementTransformationChild($useComments, $php, $tpl, $node, $elementTree, $newElementList, $resourceData);
if (count($newParameterElements) > 0 or $inputAsParameter === 'always') {
$newParameters[] = $newParameterElements;
$resetNewElementList = true;
}
}
foreach ($operatorParameters as $operatorParameter) {
$newParameterElements = eZTemplateCompiler::processElementTransformationChild($useComments, $php, $tpl, $node, $elementTree, $operatorParameter, $resourceData);
if (!$newParameterElements) {
$newParameters[] = $operatorParameter;
} else {
$newParameters[] = $newParameterElements;
}
}
$operatorParameters = $newParameters;
}
$newElements = $operatorObject->{$transformationMethod}($operatorName, $node, $tpl, $resourceData, $element, $lastElement, $elementList, $elementTree, $operatorParameters);
if (is_array($newElements)) {
if ($resetNewElementList) {
$newElementList = $newElements;
} else {
$newElementList = array_merge($newElementList, $newElements);
}
} else {
$newElementList[] = $element;
}
} else {
$newElementList[] = $element;
}
} else {
if ($resourceData['test-compile']) {
$tpl->warning('', "Operator '{$operatorName}' is not registered.");
}
}
} else {
$newElementList[] = $element;
}
$lastElement = $element;
}
return $newElementList;
}