MDL-62474 theme_boost: Fix Boost privacy provider
This commit is contained in:
committed by
Adrian Greeve
parent
9e7c397889
commit
dfcbcfc319
@@ -24,23 +24,56 @@
|
||||
|
||||
namespace theme_boost\privacy;
|
||||
|
||||
use \core_privacy\local\request\writer;
|
||||
use \core_privacy\local\metadata\collection;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* The boost theme does not store any data.
|
||||
* The boost theme stores a user preference data.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
class provider implements
|
||||
// This plugin has data.
|
||||
\core_privacy\local\metadata\provider,
|
||||
|
||||
\core_privacy\local\request\data_provider,
|
||||
|
||||
// This plugin has some sitewide user preferences to export.
|
||||
\core_privacy\local\request\user_preference_provider
|
||||
{
|
||||
|
||||
const DRAWER_OPEN_NAV = 'drawer-open-nav';
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
* Returns meta data about this system.
|
||||
*
|
||||
* @return string
|
||||
* @param collection $itemcollection The initialised item collection to add items to.
|
||||
* @return collection A listing of user data stored through this system.
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
public static function get_metadata(collection $items) : collection {
|
||||
$items->add_user_preference(self::DRAWER_OPEN_NAV, 'privacy:metadata:preference:draweropennav');
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store all user preferences for the plugin.
|
||||
*
|
||||
* @param int $userid The userid of the user whose data is to be exported.
|
||||
*/
|
||||
public static function export_user_preferences(int $userid) {
|
||||
$draweropennavpref = get_user_preferences(self::DRAWER_OPEN_NAV, null, $userid);
|
||||
|
||||
if (isset($draweropennavpref)) {
|
||||
writer::export_user_preference(
|
||||
'theme_boost',
|
||||
self::DRAWER_OPEN_NAV,
|
||||
$draweropennavpref,
|
||||
get_string('privacy:request:preference:draweropennav', 'theme_boost')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,3 +49,5 @@ $string['rawscss_desc'] = 'Use this field to provide SCSS or CSS code which will
|
||||
$string['rawscsspre'] = 'Raw initial SCSS';
|
||||
$string['rawscsspre_desc'] = 'In this field you can provide initialising SCSS code, it will be injected before everything else. Most of the time you will use this setting to define variables.';
|
||||
$string['region-side-pre'] = 'Right';
|
||||
$string['privacy:metadata:preference:draweropennav'] = 'Hide or show the left drawer menu nav.';
|
||||
$string['privacy:request:preference:draweropennav'] = 'Your preference for hide or show the left drawer menu nav';
|
||||
|
||||
Reference in New Issue
Block a user