Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
backup_theme_plugin Class Reference

Base class for theme backup plugins. More...

Inheritance diagram for backup_theme_plugin:
backup_plugin

Public Member Functions

 __construct ($plugintype, $pluginname, $optigroup, $step)
 
 define_plugin_structure ($connectionpoint)
 

Protected Member Functions

 get_plugin_element ($final_elements=null, $conditionparam=null, $conditionvalue=null)
 Factory method that will return one backup_plugin_element (backup_optigroup_element) with its name automatically calculated, based one the plugin being handled (type, name)
 
 get_recommended_name ()
 Simple helper function that suggests one name for the main nested element in plugins It's not mandatory to use it but recommended ;-)
 
 get_setting_value ($name)
 Returns the value of one (task/plan) setting.
 
 get_theme_condition ()
 Return condition for whether this theme should be backed up (= if it is the same theme as the one used in this course). More...
 

Protected Attributes

string $connectionpoint
 
string $coursetheme
 Current theme for course (may not be the same as plugin).
 
backup_optigroup_element $optigroup
 
string $pluginname
 
string $plugintype
 
backup_structure_step $step
 
backup_course_task backup_activity_task $task
 

Detailed Description

Base class for theme backup plugins.

NOTE: When you back up a course, it runs backup for ALL themes - not just the currently selected one.

That means that if, for example, a course was once in theme A, and theme A had some data settings, but it is then changed to theme B, the data settings will still be included in the backup and restore. With the restored course, if you ever change it back to theme A, the settings will be ready.

It also means that other themes which are not the one set up for the course, but might be seen by some users (eg user themes, session themes, mnet themes) can store data.

If this behaviour is not desired for a particular theme's data, the subclass can call is_current_theme('myname') to check.

Constructor & Destructor Documentation

◆ __construct()

backup_theme_plugin::__construct (   $plugintype,
  $pluginname,
  $optigroup,
  $step 
)
Parameters
string$plugintypePlugin type (always 'theme')
string$pluginnamePlugin name (name of theme)
backup_optigroup$optigroupGroup that will contain this data
backup_course_structure_step$stepBackup step that this is part of

Reimplemented from backup_plugin.

Member Function Documentation

◆ get_theme_condition()

backup_theme_plugin::get_theme_condition ( )
protected

Return condition for whether this theme should be backed up (= if it is the same theme as the one used in this course).

This condition has the theme used in the course. It will be compared against the name of the theme, by use of third parameter in get_plugin_element; in subclass, you should do: $plugin = $this->get_plugin_element(null, $this->get_theme_condition(), 'mytheme');


The documentation for this class was generated from the following file: