Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6587

Re: local plugin backup, questions hook

$
0
0
by David Mudrák.  

It depends of whether you need to attach your local plugin's data to the course, the section or a module instance in the backup. Given that your plugin is called local_foobar, the following should work (not tested) to attach your plugin's data to other modules' data.

// backup/moodle2/backup_local_foobar_plugin.class.php

class backup_local_foobar_plugin extends backup_local_plugin {

    /**
     * Returns the information to be attached to a module instance
     */
    protected function define_module_plugin_structure() {

        $plugin = $this->get_plugin_element();
        $foobar = new backup_nested_element($this->get_recommended_name());
        $plugin->add_child($filterurlresource);

        // Continue here to add more child elements to your $foobar and
        // set their data source as normally.
    }
}

For an example of how to attach your plugin's data to a course and section, see e.g. this file - it is for a course format but it should work similarly AFAIK.


Viewing all articles
Browse latest Browse all 6587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>