fid . '.visfield.'.$this->id; } protected function _getAssetTitle() { return $this->label; } protected function _getAssetParentId(Table $table = null, $id = null) { return $this->_getAssetFormId($table, $id); } public function bind($array, $ignore = '') { // bind the rules if (isset($array['rules'])) { $rules = new Rules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); } public function check() { if (empty($this->name)) { $this->name = "field-" . self::getNextOrder($this->_db->quoteName('fid').'=' . $this->_db->Quote($this->fid)); } // when we submit a form, fields are added to the $Request with the field name as request parameter name // if a field name matches a default request parameter (like id) this will be overridden with the user input for the form field // this can cause strange errors $forbiddenFieldNames = array('id', 'fid', 'view', 'task', 'option', 'lang', 'language', 'itemid', 'restrictions', 'return', 'creturn', 'tmpl', 'layout', 'format', 'extension', 'context', 'postid'); foreach($forbiddenFieldNames as $fValue) { if($this->name == $fValue) { $this->name = "field-" . self::getNextOrder($this->_db->quoteName('fid').'=' . $this->_db->Quote($this->fid)); Factory::getApplication()->enqueueMessage(Text::sprintf('COM_VISFORMS_INVALID_FIELD_NAME_REPLACED',$fValue, $this->name), 'warning'); } } // remove accented UTF-8 charachters in field name $this->name = ApplicationHelper::stringURLSafe($this->name, ENT_QUOTES); // set label if (empty($this->label)) { $this->label = $this->name; } // set ordering if (empty($this->ordering)) { // set ordering to last if ordering was 0 $this->ordering = self::getNextOrder($this->_db->quoteName('fid').'=' . $this->_db->Quote($this->fid)); } if (empty($this->dataordering)) { // set ordering to last if ordering was 0 $this->dataordering = self::getNextOrder($this->_db->quoteName('fid').'=' . $this->_db->Quote($this->fid)); } return true; } public function store($updateNulls = false) { // verify that the field name is unique (we need that for proper form validation) $table = new VisfieldTable($this->_db); //Table::getInstance('VisfieldTable', 'Administrator'); if ($table->load(array('name' => $this->name, 'fid' => $this->fid)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(Text::_('COM_VISFORMS_UNIQUE_FIELD_NAME')); return false; } $this->addCreatedByFields(); return parent::store($updateNulls = false); } public function setValue($property, $value) { $nameSpace = 'Visolutions\Component\Visforms\Administrator\Visfield\\'. ucfirst($this->typefield); try { $field = new $nameSpace($this, $property, $value); $field->setValue(); } catch (\RuntimeException $e) { $test = true; } } }