original_string: public static function report_validation_errors(array $data, array &$errors) {
          // Empty value is allowed!
          if ($data['availabilityconditionsjson'] === '') {
              return;
          }
  
          // Decode value.
          $decoded = json_decode($data['availabilityconditionsjson']);
          if (!$decoded) {
              // This shouldn't be possible.
              throw new \coding_exception('Invalid JSON from availabilityconditionsjson field');
          }
          if (!empty($decoded->errors)) {
              $error = '';
              foreach ($decoded->errors as $stringinfo) {
                  list ($component, $stringname) = explode(':', $stringinfo);
                  if ($error !== '') {
                      $error .= ' ';
                  }
                  $error .= get_string($stringname, $component);
              }
              $errors['availabilityconditionsjson'] = $error;
          }
      }
code: public static function report_validation_errors(array $data, array &$errors) {
          // Empty value is allowed!
          if ($data['availabilityconditionsjson'] === '') {
              return;
          }
  
          // Decode value.
          $decoded = json_decode($data['availabilityconditionsjson']);
          if (!$decoded) {
              // This shouldn't be possible.
              throw new \coding_exception('Invalid JSON from availabilityconditionsjson field');
          }
          if (!empty($decoded->errors)) {
              $error = '';
              foreach ($decoded->errors as $stringinfo) {
                  list ($component, $stringname) = explode(':', $stringinfo);
                  if ($error !== '') {
                      $error .= ' ';
                  }
                  $error .= get_string($stringname, $component);
              }
              $errors['availabilityconditionsjson'] = $error;
          }
      }
code_tokens: public static function report_validation_errors ( array $ data , array & $ errors ) { // Empty value is allowed! if ( $ data [ 'availabilityconditionsjson' ] === '' ) { return ; } // Decode value. $ decoded = json_decode ( $ data [ 'availabilityconditionsjson' ] ) ; if ( ! $ decoded ) { // This shouldn't be possible. throw new \ coding_exception ( 'Invalid JSON from availabilityconditionsjson field' ) ; } if ( ! empty ( $ decoded -> errors ) ) { $ error = '' ; foreach ( $ decoded -> errors as $ stringinfo ) { list ( $ component , $ stringname ) = explode ( ':' , $ stringinfo ) ; if ( $ error !== '' ) { $ error .= ' ' ; } $ error .= get_string ( $ stringname , $ component ) ; } $ errors [ 'availabilityconditionsjson' ] = $ error ; } }
docstring: For use within forms, reports any validation errors from the availability
  field.
  
  @param array $data Form data fields
  @param array $errors Error array
docstring_tokens: For use within forms reports any validation errors from the availability field .