/** * called when the element is saved */ function onSave() { $params =& $this->getParams(); if (!$this->isJoin()) { $params = JRequest::getVar('params', array(), 'post', 'array'); $details = JRequest::getVar('details', array(), 'post', 'array'); $element =& $this->getElement(); //load join based on this element id $join =& JTable::getInstance('Join', 'Table'); $origKey = $join->_tbl_key; $join->_tbl_key = "element_id"; $join->load($this->_id); $join->_tbl_key = $origKey; $join->table_join = $params['join_db_name']; $join->join_type = 'left'; $join->group_id = $details['group_id']; $join->table_key = str_replace('`', '', $element->name); //$join->table_key = $params['join_val_column']; $join->table_join_key = $params['join_key_column']; $join->join_from_table = ''; $join->attribs = "join-label=" . $params['join_val_column'] . "\n"; $join->store(); } return parent::onSave(); }