Restore API for filter_[name] plugins?

Restore API for filter_[name] plugins?

by Matt Donnelly -
Number of replies: 2

Wondering if anyone can tell me if it's possible to hook into the course restore process from a filter plugin? I've tried implementing classes in a backup/moodle2 directory in the filter folder, but they don't seem to work, so I think it might not even be possible. Here's the situation:

I've written a filter plugin called filter_check_available_complete that shows or hides DOM elements (i.e. parts of content in course module text areas) based on whether one or more course modules are either available to or have been completed by the currently logged-in user. It's pretty simple: it looks for a data-filter-check attribute on a HTML tag, and does its thing. So for instance:

<div data-filter-check=“show 123, 456, 789 complete”>This DIV will display when those CMs are complete</div>
or 
<div data-filter-check=“hide 123, 456, 789 available”>This DIV will not display when those CMs are available</div>

It works great, except I want to be able hook into the restore process so those provided course module IDs (i.e. 123, 456, 789) map to the correct new course modules IDs in the restored course. 

Any ideas would be appreciated, thanks!

Average of ratings: -
In reply to Matt Donnelly

Re: Restore API for filter_[name] plugins?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I believe this is not possible for filters. When I made filter_embedquestion, I had to make a related report_embedquestion to store the data.
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Restore API for filter_[name] plugins?

by Matt Donnelly -

Thanks Tim. Will explore the dependency plugin approach.


.