public function validation($data, $files) {
        $errors = parent::validation($data, $files);

        if ($files = $this->get_draft_files('rolepreset')) {
            /** @var stored_file $file */
            $file = reset($files);
            $xml = $file->get_content();
            if (!core_role_preset::is_valid_preset($xml)) {
                $errors['rolepreset'] = get_string('invalidpresetfile', 'core_role');
            }
        }

        return $errors;
    }
public function validation($data, $files) {
        $errors = parent::validation($data, $files);

        if ($files = $this->get_draft_files('rolepreset')) {
            /** @var stored_file $file */
            $file = reset($files);
            $xml = $file->get_content();
            if (!core_role_preset::is_valid_preset($xml)) {
                $errors['rolepreset'] = get_string('invalidpresetfile', 'core_role');
            }
        }

        return $errors;
    }
public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; if ( $ files = $ this -> get_draft_files ( 'rolepreset' ) ) { /** @var stored_file $file */ $ file = reset ( $ files ) ; $ xml = $ file -> get_content ( ) ; if ( ! core_role_preset :: is_valid_preset ( $ xml ) ) { $ errors [ 'rolepreset' ] = get_string ( 'invalidpresetfile' , 'core_role' ) ; } } return $ errors ; }
Validate this form.

@param array $data submitted data
@param array $files not used
@return array errors
Validate this form .