Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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   * This file defines a link to another Moodle plugin.
  19   *
  20   * @package core_privacy
  21   * @copyright 2018 Zig Tan <zig@moodle.com>
  22   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  namespace core_privacy\local\metadata\types;
  25  
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  /**
  29   * The plugintype link.
  30   *
  31   * @copyright 2018 Zig Tan <zig@moodle.com>
  32   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33   */
  34  class plugintype_link implements type {
  35  
  36      /**
  37       * @var The name of the core plugintype to link.
  38       */
  39      protected $name;
  40  
  41      /**
  42       * @var array The list of data names and descriptions.
  43       */
  44      protected $privacyfields;
  45  
  46      /**
  47       * @var string A description of what this plugintype is used to store.
  48       */
  49      protected $summary;
  50  
  51      /**
  52       * Constructor for the plugintype_link.
  53       *
  54       * @param   string  $name The name of the plugintype to link.
  55       * @param   string  $summary A description of what is stored within this plugintype.
  56       */
  57      public function __construct($name, $privacyfields = [], $summary = '') {
  58          if (debugging('', DEBUG_DEVELOPER)) {
  59              $teststring = clean_param($summary, PARAM_STRINGID);
  60              if ($teststring !== $summary) {
  61                  debugging("Summary information for use of the '{$name}' plugintype " .
  62                      "has an invalid langstring identifier: '{$summary}'",
  63                      DEBUG_DEVELOPER);
  64              }
  65          }
  66  
  67          $this->name = $name;
  68          $this->privacyfields = $privacyfields;
  69          $this->summary = $summary;
  70      }
  71  
  72      /**
  73       * Function to return the name of this plugintype_link type.
  74       *
  75       * @return string $name
  76       */
  77      public function get_name() {
  78          return $this->name;
  79      }
  80  
  81      /**
  82       * A plugintype link does not define any fields itself.
  83       *
  84       * @return  array
  85       */
  86      public function get_privacy_fields() : array {
  87          return $this->privacyfields;
  88      }
  89  
  90      /**
  91       * A summary of what this plugintype is used for.
  92       *
  93       * @return string $summary
  94       */
  95      public function get_summary() {
  96          return $this->summary;
  97      }
  98  }