Don't clear children if tabs attribute not provided

This commit is contained in:
Ralf Becker 2014-07-23 09:15:00 +00:00
parent 0abcd5e68f
commit 6a7258e98e

View File

@ -38,6 +38,10 @@ class etemplate_widget_tabbox extends etemplate_widget
* @param boolean $respect_disabled=false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children * @param boolean $respect_disabled=false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children
*/ */
public function run($method_name, $params=array(''), $respect_disabled=false) public function run($method_name, $params=array(''), $respect_disabled=false)
{
// Make sure additional tabs are processed for any method
if($this->attrs['tabs'])
{ {
// add_tabs toggles replacing or adding to existing tabs // add_tabs toggles replacing or adding to existing tabs
if(!$this->attrs['add_tabs']) if(!$this->attrs['add_tabs'])
@ -45,7 +49,6 @@ class etemplate_widget_tabbox extends etemplate_widget
$this->children[1]->children = array(); $this->children[1]->children = array();
} }
// Make sure additional tabs are processed for any method
foreach($this->attrs['tabs'] as $tab) foreach($this->attrs['tabs'] as $tab)
{ {
$template= clone etemplate_widget_template::instance($tab['template']); $template= clone etemplate_widget_template::instance($tab['template']);
@ -53,6 +56,7 @@ class etemplate_widget_tabbox extends etemplate_widget
$this->children[1]->children[] = $template; $this->children[1]->children[] = $template;
unset($template); unset($template);
} }
}
// Check for disabled tabs set via readonly, and set them as disabled // Check for disabled tabs set via readonly, and set them as disabled
$form_name = self::form_name($params[0], $this->id, $params[1]); $form_name = self::form_name($params[0], $this->id, $params[1]);