original_string: public function define_validate_specific($data, $files) {
          $err = array();
  
          $data->param1 = str_replace("\r", '', $data->param1);
  
          // Check that we have at least 2 options.
          if (($options = explode("\n", $data->param1)) === false) {
              $err['param1'] = get_string('profilemenunooptions', 'admin');
          } else if (count($options) < 2) {
              $err['param1'] = get_string('profilemenutoofewoptions', 'admin');
          } else if (!empty($data->defaultdata) and !in_array($data->defaultdata, $options)) {
              // Check the default data exists in the options.
              $err['defaultdata'] = get_string('profilemenudefaultnotinoptions', 'admin');
          }
          return $err;
      }
code: public function define_validate_specific($data, $files) {
          $err = array();
  
          $data->param1 = str_replace("\r", '', $data->param1);
  
          // Check that we have at least 2 options.
          if (($options = explode("\n", $data->param1)) === false) {
              $err['param1'] = get_string('profilemenunooptions', 'admin');
          } else if (count($options) < 2) {
              $err['param1'] = get_string('profilemenutoofewoptions', 'admin');
          } else if (!empty($data->defaultdata) and !in_array($data->defaultdata, $options)) {
              // Check the default data exists in the options.
              $err['defaultdata'] = get_string('profilemenudefaultnotinoptions', 'admin');
          }
          return $err;
      }
code_tokens: public function define_validate_specific ( $ data , $ files ) { $ err = array ( ) ; $ data -> param1 = str_replace ( "\r" , '' , $ data -> param1 ) ; // Check that we have at least 2 options. if ( ( $ options = explode ( "\n" , $ data -> param1 ) ) === false ) { $ err [ 'param1' ] = get_string ( 'profilemenunooptions' , 'admin' ) ; } else if ( count ( $ options ) < 2 ) { $ err [ 'param1' ] = get_string ( 'profilemenutoofewoptions' , 'admin' ) ; } else if ( ! empty ( $ data -> defaultdata ) and ! in_array ( $ data -> defaultdata , $ options ) ) { // Check the default data exists in the options. $ err [ 'defaultdata' ] = get_string ( 'profilemenudefaultnotinoptions' , 'admin' ) ; } return $ err ; }
docstring: Validates data for the profile field.
  
  @param array $data
  @param array $files
  @return array
docstring_tokens: Validates data for the profile field .