Implement 'add_tab' attribute on server side, so it works.

This commit is contained in:
Nathan Gray 2013-12-12 20:15:36 +00:00
parent 39c53c5530
commit ffcc62e274

View File

@ -17,15 +17,19 @@
class etemplate_widget_tabbox extends etemplate_widget
{
/**
* Fill additional tabs
*
* @param string $cname
*/
public function beforeSendToClient($cname)
{
* Fill additional tabs
*
* @param string $cname
*/
public function beforeSendToClient($cname)
{
if($this->attrs['tabs'])
{
$this->children[1]->children = array();
// add_tabs toggles replacing or adding to existing tabs
if(!$this->attrs['add_tabs'])
{
$this->children[1]->children = array();
}
foreach($this->attrs['tabs'] as $tab)
{
if($tab['id'])
@ -68,7 +72,12 @@ class etemplate_widget_tabbox extends etemplate_widget
}
// Make sure additional tabs are processed
$this->children[1]->children = array();
// add_tabs toggles replacing or adding to existing tabs
if(!$this->attrs['add_tabs'])
{
$this->children[1]->children = array();
}
foreach($this->attrs['tabs'] as $tab)
{
if($tab['id'] && $content[$tab['id']])
@ -82,6 +91,12 @@ class etemplate_widget_tabbox extends etemplate_widget
$tab_valid = $content[$tab['id']];
*/
}
else
{
$template= clone etemplate_widget_template::instance($tab['template']);
$this->children[1]->children[] = $template;
unset($template);
}
}
$valid = $value;
}