Files
smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php

43 lines
1.3 KiB
PHP
Raw Normal View History

<?php
/**
2010-08-17 15:39:51 +00:00
* Smarty Internal Plugin Compile Object Block Function
* Compiles code for registered objects as block function
2011-09-16 14:19:56 +00:00
*
* @package Smarty
2010-08-17 15:39:51 +00:00
* @subpackage Compiler
* @author Uwe Tews
2010-08-17 15:39:51 +00:00
*/
/**
2010-08-17 15:39:51 +00:00
* Smarty Internal Plugin Compile Object Block Function Class
2011-09-16 14:19:56 +00:00
*
* @package Smarty
2011-09-16 14:19:56 +00:00
* @subpackage Compiler
2010-08-17 15:39:51 +00:00
*/
2016-01-02 11:27:44 +01:00
class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_Compile_Private_Block_Plugin
{
2011-09-16 14:19:56 +00:00
/**
2016-01-02 11:27:44 +01:00
* Setup callback and parameter array
2011-09-16 14:19:56 +00:00
*
2016-01-02 11:27:44 +01:00
* @param \Smarty_Internal_TemplateCompilerBase $compiler
* @param array $_attr attributes
2018-06-12 09:58:15 +02:00
* @param string $tag
* @param string $method
2011-09-16 14:19:56 +00:00
*
2016-01-02 11:27:44 +01:00
* @return array
2010-08-17 15:39:51 +00:00
*/
2016-01-02 11:27:44 +01:00
public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $method)
{
2016-01-02 11:27:44 +01:00
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {
2016-01-02 11:27:44 +01:00
$_paramsArray[] = "'$_key'=>$_value";
}
2011-09-16 14:19:56 +00:00
}
$callback = array("\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]", "->{$method}");
return array($callback, $_paramsArray, "array(\$_block_plugin{$this->nesting}, '{$method}')");
2011-09-16 14:19:56 +00:00
}
}