original_string: public function write_setting($data) {
          if (!is_array($data)) {
              return '';
          }
          $this->load_choices();
          $save = array();
          foreach($data as $datum) {
              if ($datum == 'none' or !array_key_exists($datum, $this->choices)) {
                  continue;
              }
              $save[$datum] = $datum; // no duplicates
          }
          return ($this->config_write($this->name, implode(',', $save)) ? '' : get_string('errorsetting', 'admin'));
      }
code: public function write_setting($data) {
          if (!is_array($data)) {
              return '';
          }
          $this->load_choices();
          $save = array();
          foreach($data as $datum) {
              if ($datum == 'none' or !array_key_exists($datum, $this->choices)) {
                  continue;
              }
              $save[$datum] = $datum; // no duplicates
          }
          return ($this->config_write($this->name, implode(',', $save)) ? '' : get_string('errorsetting', 'admin'));
      }
code_tokens: public function write_setting ( $ data ) { if ( ! is_array ( $ data ) ) { return '' ; } $ this -> load_choices ( ) ; $ save = array ( ) ; foreach ( $ data as $ datum ) { if ( $ datum == 'none' or ! array_key_exists ( $ datum , $ this -> choices ) ) { continue ; } $ save [ $ datum ] = $ datum ; // no duplicates } return ( $ this -> config_write ( $ this -> name , implode ( ',' , $ save ) ) ? '' : get_string ( 'errorsetting' , 'admin' ) ) ; }
docstring: Save the selected options
  
  @param array $data
  @return mixed empty string (data is not an array) or bool true=success false=failure
docstring_tokens: Save the selected options