Permalink
Browse files

[smarty:plugins:legacy_tree] add error handling, fix notice error

  • Loading branch information...
nao-pon committed Apr 20, 2015
1 parent e98cd27 commit e2432326ca664848930dbe4dc1fe8255b2b1ff50
Showing with 10 additions and 4 deletions.
  1. +10 −4 xoops_trust_path/libs/smarty/plugins/function.legacy_tree.php
@@ -19,17 +19,23 @@
function smarty_function_legacy_tree($params, &$smarty)
{
$tree = $params['tree'];
$control = $params['control'];
$dirname = $params['dirname'];
$className = $params['className'] ? $params['className'] : 'tree';
$tree = isset($params['tree']) ? $params['tree'] : null;
if (!is_array($tree) || !($tree[0] instanceof Legacy_AbstractCategoryObject)) {
echo '<p>Invalid parameter `tree` in {legacy_tree}</p>';
return;
}
$control = !empty($params['control']);
$dirname = isset($params['dirname']) ? $params['dirname'] : '';
$className = isset($params['className']) ? $params['className'] : 'tree';
$template = isset($params['template']) ? $params['template'] : 'legacy_inc_tree.html';
//render template
$render = new XCube_RenderTarget();
$render->setTemplateName($template);
$render->setAttribute('legacy_buffertype',XCUBE_RENDER_TARGET_TYPE_MAIN);
$render->setAttribute('tree', $tree);
$render->setAttribute('control', $control);
$render->setAttribute('dirname', $dirname);
$render->setAttribute('className', $className);
XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);

0 comments on commit e243232

Please sign in to comment.