I'm trying to pass a stdclass (containing array of measurement and name details) using a new Lang_String in Moodle plugin code:
redirect(new moodle_url('/mod/healthtracker/profile_measurements.php', ['id' => $userMeasurement->userid, 'course' => $userMeasurement->courseid]), new lang_string('delete_patient_measurement_success', 'mod_healthtracker', (object)compact('user','measurement')), \core\output\notification::NOTIFY_SUCCESS);
the lang sting itself being:
'delete_patient_measurement_success' => 'The {$a->measurement->name} measurement has been removed from {$a->user->firstname} {$a->user->lastname}',
however at present the output is:
The {$a->measurement->name} measurement has been removed from {$a->user->firstname} {$a->user->lastname}
whereas I actually want the lang string to display the variable values e.g. 'Blood Pressure' in place of {$a->measurement->name} and 'Bob' in place of {$a->user->firstname}
- I think the (object)compact('user','measurement')) is the issue here but is not sure where the syntax is incorrect - any help greatfully received!