3 * This file is part of Smarty.
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * Smarty Internal Plugin Compile Block Parent Class
14 * @author Uwe Tews <uwe.tews@googlemail.com>
16 class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Shared_Inheritance
20 * Attribute definition: Overwrites base class.
23 * @see Smarty_Internal_CompileBase
25 public $optional_attributes = array('name');
28 * Attribute definition: Overwrites base class.
31 * @see Smarty_Internal_CompileBase
33 public $shorttag_order = array('name');
36 * Attribute definition: Overwrites base class.
39 * @see Smarty_Internal_CompileBase
41 public $option_flags = array();
44 * Saved compiler object
46 * @var Smarty_Internal_TemplateCompilerBase
48 public $compiler = null;
51 * Compiles code for the {block_parent} tag
53 * @param array $args array with attributes from parser
54 * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
55 * @param array $parameter array with compilation parameter
59 public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
61 // check and get attributes
62 $_attr = $this->getAttributes($compiler, $args);
63 if (!isset($compiler->_cache[ 'blockNesting' ])) {
64 $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ',
65 $compiler->parser->lex->taglineno);
67 $compiler->suppressNocacheProcessing = true;
68 $compiler->has_code = true;
69 $output = "<?php \n\$_smarty_tpl->inheritance->callParent(\$_smarty_tpl, \$this" .
70 (isset($_attr[ 'name' ]) ? ", {$_attr[ 'name' ]}" : '') . ");\n?>\n";