attrs['tabs'] && !$this->tabs_attr_evaluated) { $this->tabs_attr_evaluated = true; // we must not evaluate tabs attribte more then once! // add_tabs toggles replacing or adding to existing tabs if(!$this->attrs['add_tabs']) { $this->children[1]->children = array(); } $this->tabs = array(); foreach($this->attrs['tabs'] as $tab) { $template= clone etemplate_widget_template::instance($tab['template']); if($tab['id']) $template->attrs['content'] = $tab['id']; $this->children[1]->children[] = $template; $tab['url'] = etemplate_widget_template::rel2url($template->rel_path); $this->tabs[] = $tab; unset($template); } } // Check for disabled tabs set via readonly, and set them as disabled $form_name = self::form_name($params[0], $this->id, $params[1]); $readonlys = self::get_array(self::$request->readonlys, $form_name); if($respect_disabled && $readonlys) { foreach($this->children[1]->children as $tab) { $parts = explode('.',$tab->template ? $tab->template : $tab->id); $ro_id = array_pop($parts); if($readonlys[$ro_id]) { $tab->attrs['disabled'] = $readonlys[$ro_id]; } } } // Tabs are set up now, continue as normal parent::run($method_name, $params, $respect_disabled); } /** * Implemented to send tab-urls incl. cache-buster and mobile template switch to client-side * * They are send as tab_urls object via modifications. * * @param string $cname */ public function beforeSendToClient($cname) { $form_name = self::form_name($cname, $this->id); if (!empty($this->tabs)) { self::setElementAttribute($form_name, 'tabs', $this->tabs); } } /** * Validate input - just pass through, tabs doesn't care * * @param string $cname current namespace * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' * @param array $content * @param array &$validated=array() validated content * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont' */ public function validate($cname, array $expand, array $content, &$validated=array()) { $form_name = self::form_name($cname, $this->id, $expand); if (!empty($form_name)) { $value = self::get_array($content, $form_name); $valid =& self::get_array($validated, $form_name, true); if (true) $valid = $value; } } } etemplate_widget::registerWidget('etemplate_widget_tabbox', array('tabbox'));