The filter can do this:
// Check our context and get the course id
$coursectx = $this->context->get_course_context(false);
$courseid = $coursectx->instanceid;
Which is fine. However, I can't seem to find a way of telling if the filter is inside a module such as a lesson or a wiki and what it's id might be.
Once the filter has done it's job, I would like to get back to the module rather than the course, if possible.
Thanks if you can help.