Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | List of all members
mod_data\privacy\datafield_provider Interface Reference

Interface datafield_provider, all datafield plugins need to implement it. More...

Inheritance diagram for mod_data\privacy\datafield_provider:
core_privacy\local\request\plugin\subplugin_provider core_privacy\local\request\shared_userlist_provider core_privacy\local\request\shared_data_provider core_privacy\local\request\userlist_provider core_privacy\local\request\data_provider datafield_checkbox\privacy\provider datafield_date\privacy\provider datafield_file\privacy\provider datafield_latlong\privacy\provider datafield_menu\privacy\provider datafield_multimenu\privacy\provider datafield_number\privacy\provider datafield_picture\privacy\provider datafield_radiobutton\privacy\provider datafield_text\privacy\provider datafield_textarea\privacy\provider datafield_url\privacy\provider

Static Public Member Functions

static delete_data_content ($context, $recordobj, $fieldobj, $contentobj)
 Allows plugins to delete locally stored data. More...
 
static export_data_content ($context, $recordobj, $fieldobj, $contentobj, $defaultvalue)
 Exports data about one record in {data_content} table. More...
 

Detailed Description

Interface datafield_provider, all datafield plugins need to implement it.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ delete_data_content()

static mod_data\privacy\datafield_provider::delete_data_content (   $context,
  $recordobj,
  $fieldobj,
  $contentobj 
)
static

Allows plugins to delete locally stored data.

Usually datafield plugins do not store anything and this method will be empty.

Parameters
context_module$context
stdClass$recordobjrecord from DB table {data_records}
stdClass$fieldobjrecord from DB table {data_fields}
stdClass$contentobjrecord from DB table {data_content}

Implemented in datafield_url\privacy\provider, datafield_textarea\privacy\provider, datafield_text\privacy\provider, datafield_radiobutton\privacy\provider, datafield_picture\privacy\provider, datafield_number\privacy\provider, datafield_multimenu\privacy\provider, datafield_menu\privacy\provider, datafield_latlong\privacy\provider, datafield_file\privacy\provider, datafield_date\privacy\provider, and datafield_checkbox\privacy\provider.

◆ export_data_content()

static mod_data\privacy\datafield_provider::export_data_content (   $context,
  $recordobj,
  $fieldobj,
  $contentobj,
  $defaultvalue 
)
static

Exports data about one record in {data_content} table.

Datafield plugins providers should implement this method to:

  • preprocess references to files in the response (examples - textarea, picture, file)
  • make content more human-readable (example - replace values separators in multimenu, format date in date)
  • add more information about the field itself (example - list all options for menu, multimenu, radio)

Sample implementation (from datafield_textarea):

$defaultvalue->content = writer::with_context($context) ->rewrite_pluginfile_urls([$recordobj->id, $contentobj->id], 'mod_data', 'content', $contentobj->id, $defaultvalue->content); writer::with_context($context)->export_data([$recordobj->id, $contentobj->id], $defaultvalue);

Parameters
context_module$context
stdClass$recordobjrecord from DB table {data_records}
stdClass$fieldobjrecord from DB table {data_fields}
stdClass$contentobjrecord from DB table {data_content}
stdClass$defaultvaluepre-populated default value that most of plugins will use

Implemented in datafield_url\privacy\provider, datafield_textarea\privacy\provider, datafield_text\privacy\provider, datafield_radiobutton\privacy\provider, datafield_picture\privacy\provider, datafield_number\privacy\provider, datafield_multimenu\privacy\provider, datafield_menu\privacy\provider, datafield_latlong\privacy\provider, datafield_file\privacy\provider, datafield_date\privacy\provider, and datafield_checkbox\privacy\provider.


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