original_string: public function config_form_validation(array $data, $files = array()) : array {
          $options = preg_split("/\s*\n\s*/", trim($data['configdata']['options']));
          $errors = [];
          if (!$options || count($options) < 2) {
              $errors['configdata[options]'] = get_string('errornotenoughoptions', 'customfield_select');
          } else if (!empty($data['configdata']['defaultvalue'])) {
              $defaultkey = array_search($data['configdata']['defaultvalue'], $options);
              if ($defaultkey === false) {
                  $errors['configdata[defaultvalue]'] = get_string('errordefaultvaluenotinlist', 'customfield_select');
              }
          }
          return $errors;
      }
code: public function config_form_validation(array $data, $files = array()) : array {
          $options = preg_split("/\s*\n\s*/", trim($data['configdata']['options']));
          $errors = [];
          if (!$options || count($options) < 2) {
              $errors['configdata[options]'] = get_string('errornotenoughoptions', 'customfield_select');
          } else if (!empty($data['configdata']['defaultvalue'])) {
              $defaultkey = array_search($data['configdata']['defaultvalue'], $options);
              if ($defaultkey === false) {
                  $errors['configdata[defaultvalue]'] = get_string('errordefaultvaluenotinlist', 'customfield_select');
              }
          }
          return $errors;
      }
code_tokens: public function config_form_validation ( array $ data , $ files = array ( ) ) : array { $ options = preg_split ( "/\s*\n\s*/" , trim ( $ data [ 'configdata' ] [ 'options' ] ) ) ; $ errors = [ ] ; if ( ! $ options || count ( $ options ) < 2 ) { $ errors [ 'configdata[options]' ] = get_string ( 'errornotenoughoptions' , 'customfield_select' ) ; } else if ( ! empty ( $ data [ 'configdata' ] [ 'defaultvalue' ] ) ) { $ defaultkey = array_search ( $ data [ 'configdata' ] [ 'defaultvalue' ] , $ options ) ; if ( $ defaultkey === false ) { $ errors [ 'configdata[defaultvalue]' ] = get_string ( 'errordefaultvaluenotinlist' , 'customfield_select' ) ; } } return $ errors ; }
docstring: Validate the data from the config form.
  Sub classes must reimplement it.
  
  @param array $data from the add/edit profile field form
  @param array $files
  @return array associative array of error messages
docstring_tokens: Validate the data from the config form . Sub classes must reimplement it .