public function write_setting($data) {
        if ((string)$data === $this->yes) { // convert to strings before comparison
            $data = $this->yes;
        } else {
            $data = $this->no;
        }
        return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
    }
public function write_setting($data) {
        if ((string)$data === $this->yes) { // convert to strings before comparison
            $data = $this->yes;
        } else {
            $data = $this->no;
        }
        return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
    }
public function write_setting ( $ data ) { if ( ( string ) $ data === $ this -> yes ) { // convert to strings before comparison $ data = $ this -> yes ; } else { $ data = $ this -> no ; } return ( $ this -> config_write ( $ this -> name , $ data ) ? '' : get_string ( 'errorsetting' , 'admin' ) ) ; }
Sets the value for the setting

Sets the value for the setting to either the yes or no values
of the object by comparing $data to yes

@param mixed $data Gets converted to str for comparison against yes value
@return string empty string or error
Sets the value for the setting