Ferreteria/v3/class/tMakableFieldRow

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Ferreteria‎ | v3‎ | class
Jump to: navigation, search
// PURPOSE: adds functionality to create fields as needed
trait tMakableFieldRow {
    /*----
      PURPOSE: sets an individual value
      OVERRIDE: will create Field object if not set
    */
    public function SetValue($sKey, $val) {
        $oField = $this->MakeField($sKey);
        $oField->SetValue($val);
    }
    protected function MakeField($sKey) {
        $oField = NULL;
        if ($this->FieldIsSet($sKey)) {
            $oField = $this->RetrieveField($sKey);
        }
        if (is_null($oField)) {
            $sClass = $this->GetClass_forField($sKey);
            $oField = new $sClass($sKey,$this);
            $this->SetField($oField);
        }
        return $oField;
    }
}