public function validate($data) {
        if (empty($data)) {
            return true;
        }

        try {
            \core_auth\digital_consent::parse_age_digital_consent_map($data);
        } catch (\moodle_exception $e) {
            return get_string('invalidagedigitalconsent', 'admin', $e->getMessage());
        }

        return true;
    }
public function validate($data) {
        if (empty($data)) {
            return true;
        }

        try {
            \core_auth\digital_consent::parse_age_digital_consent_map($data);
        } catch (\moodle_exception $e) {
            return get_string('invalidagedigitalconsent', 'admin', $e->getMessage());
        }

        return true;
    }
public function validate ( $ data ) { if ( empty ( $ data ) ) { return true ; } try { \ core_auth \ digital_consent :: parse_age_digital_consent_map ( $ data ) ; } catch ( \ moodle_exception $ e ) { return get_string ( 'invalidagedigitalconsent' , 'admin' , $ e -> getMessage ( ) ) ; } return true ; }
Validate the content and format of the age of digital consent map to ensure it is parsable.

@param string $data The age of digital consent map from text field.
@return mixed bool true for success or string:error on failure.
Validate the content and format of the age of digital consent map to ensure it is parsable .