Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Defines backup_theme_plugin class

Copyright: 2011 onwards The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 81 lines (3 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

backup_theme_plugin:: (2 methods):
  __construct()
  get_theme_condition()


Class: backup_theme_plugin  - X-Ref

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.
__construct($plugintype, $pluginname, $optigroup, $step)   X-Ref

param: string $plugintype Plugin type (always 'theme')
param: string $pluginname Plugin name (name of theme)
param: backup_optigroup $optigroup Group that will contain this data
param: backup_course_structure_step $step Backup step that this is part of

get_theme_condition()   X-Ref
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');