Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Contains interface customfield_provider
  19   *
  20   * @package core_customfield
  21   * @copyright 2018 Marina Glancy
  22   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace core_customfield\privacy;
  26  
  27  use core_customfield\data_controller;
  28  
  29  defined('MOODLE_INTERNAL') || die();
  30  
  31  /**
  32   * Interface customfield_provider, all customfield plugins need to implement it
  33   *
  34   * @package core_customfield
  35   * @copyright 2018 Marina Glancy
  36   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  37   */
  38  interface customfield_provider extends
  39          \core_privacy\local\request\plugin\subplugin_provider,
  40  
  41          // The customfield plugins do not need to do anything themselves for the shared_userlist.
  42          // This is all handled by the component core_customfield.
  43          \core_privacy\local\request\shared_userlist_provider
  44      {
  45  
  46      /**
  47       * Preprocesses data object that is going to be exported
  48       *
  49       * Minimum implementation:
  50       *     writer::with_context($data->get_context())->export_data($subcontext, $exportdata);
  51       *
  52       * @param data_controller $data
  53       * @param \stdClass $exportdata generated object to be exported
  54       * @param array $subcontext subcontext to use when exporting
  55       * @return mixed
  56       */
  57      public static function export_customfield_data(data_controller $data, \stdClass $exportdata, array $subcontext);
  58  
  59      /**
  60       * Allows plugins to delete everything they store related to the data (usually files)
  61       *
  62       * If plugin does not store any related files or other information, implement as an empty function
  63       *
  64       * @param string $dataidstest select query for data id (note that it may also return data for other field types)
  65       * @param array $params named parameters for the select query
  66       * @param array $contextids list of affected data contexts
  67       * @return mixed
  68       */
  69      public static function before_delete_data(string $dataidstest, array $params, array $contextids);
  70  
  71      /**
  72       * Allows plugins to delete everything they store related to the field configuration (usually files)
  73       *
  74       * The implementation should not delete data or anything related to the data, since "before_delete_data" is
  75       * invoked separately.
  76       *
  77       * If plugin does not store any related files or other information, implement as an empty function
  78       *
  79       * @param string $fieldidstest select query for field id (note that it may also return fields of other types)
  80       * @param array $params named parameters for the select query
  81       * @param int[] $contextids list of affected configuration contexts
  82       */
  83      public static function before_delete_fields(string $fieldidstest, array $params, array $contextids);
  84  }