Launching external site from LTI Source plugin

Launching external site from LTI Source plugin

by Kyril Revels -
Number of replies: 0

I'm very new to Moodle plugin development, so please bear with me a bit.

Recently, I've started development on an LTI source plugin, which adds a new External Tool subtype to the Activity chooser, using the get_types hook.  This ticket was invaluable with helping me get everything set up:

So, my next steps would have been to use the add_instance_hook to provide a custom form for the user to configure the tool instance.  However, upon further reading of the above thread it appears that add_instance_hook receives no reference to the form (it actually receives no arguments at all), and instead it is expected that the hook is used to redirect the user an external site.

After the redirect, I imagine the workflow would be (and please let me know if my assumptions are wrong here):

  1. User sets configuration values in the external site
  2. External site sends a custom request back to the mod/lti plugin (service.php) with relevant configuration values
  3. The LTI source plugin consumes the custom request, and finishes configuring the instance.

I've been able to wrap my head around this so far, but the one piece that is still missing is how the initial request gets to the external site in the first place.  All the examples I've seen are mysteriously quiet about this smile  

What seems to make the most sense to me is that I would send an LTI launch request to the external site/tool provider within the add_instance_hook, since that would give the external site the proper context. However, I haven't seen any documentation about how to make such requests programmatically. I'm assuming that if the administrator has already configured the plugin with the launch URL to my provider, I can just query the details from the database, but how to perform the actual launch?

Or am I just way off base here, and the expectation was only for add_instance_hook to trigger a simple 302 redirect?

Average of ratings: -