Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

(no description)

File Size: 254 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_adminpresets_generator:: (6 methods):
  create_preset()
  apply_setting()
  apply_plugin()
  add_to_config_log()
  access_protected()
  get_admin_preset_setting()


Class: core_adminpresets_generator  - X-Ref

Data generator for adminpresets component.

create_preset(array $data = [])   X-Ref
Create a preset. This preset will have only 3 settings and 3 plugins.
Settings:
- none.enablebadges = 0
- none.allowemojipicker = 1
- mod_lesson.mediawidth = 900
- mod_lesson.maxanswers = 2 with advanced disabled.
Plugins:
- enrol_guest = 0
- mod_glossary = 0
- qtype_truefalse = 1

param: array $data Preset data. Supported values:
return: int Identifier of the preset created.

apply_setting(int $appid, string $name, string $oldvalue, string $newvalue, ?string $plugin = null,?string $itemname = null)   X-Ref
Helper method to create an applied setting item.

param: int $appid The applied preset identifier.
param: string $name The setting name.
param: string $oldvalue The setting old value.
param: string $newvalue The setting new value.
param: string|null $plugin The setting plugin (or null if none).
param: string|null $itemname Whether it should be treated as advanced item or not.
return: bool|int true or new id.

apply_plugin(int $appid, string $plugin, string $name, int $oldvalue, int $newvalue)   X-Ref
Helper method to create an applied plugin.

param: int $appid The applied preset identifier.
param: string $plugin The plugin type.
param: string $name The plugin name.
param: int $oldvalue The setting old value.
param: int $newvalue The setting new value.
return: bool|int true or new id.

add_to_config_log(string $name, string $oldvalue, string $value, ?string $plugin = null)   X-Ref
Helper method to add entry in config_log.

param: string $name The setting name.
param: string $oldvalue The setting old value.
param: string $value The setting new value.
param: string|null $plugin The setting plugin (or null if the setting doesn't belong to any plugin).
return: int The id of the config_log entry created.

access_protected($object, string $property)   X-Ref
Helper method to access to a protected property.

param: string|object $object The class.
param: string $property The private/protected property in $object to access.
return: mixed The current value of the property.

get_admin_preset_setting(string $category, string $settingname)   X-Ref
Given a tree category and setting name, it gets the adminpresets_setting class.

param: string $category Tree category name where the setting is located.
param: string $settingname Setting name to get the class.
return: adminpresets_setting