MDL-73424 general: specify return type where possible
[moodle.git] / tag / classes / external / tag_area_exporter.php
blob1cc74e13bb73205df0123de6ddf7fbb7e61af636
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.
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/>.
17 /**
18 * Contains related class for displaying information of a tag area.
20 * @package core_tag
21 * @copyright 2019 Juan Leyva <juan@moodle.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace core_tag\external;
27 defined('MOODLE_INTERNAL') || die();
29 use core\external\exporter;
30 use renderer_base;
32 /**
33 * Contains related class for displaying information of a tag area.
35 * @package core_tag
36 * @copyright 2019 Juan Leyva <juan@moodle.com>
37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39 class tag_area_exporter extends exporter {
41 /**
42 * Return the list of properties.
44 * @return array
46 protected static function define_properties() {
47 return [
48 'id' => [
49 'type' => PARAM_INT,
50 'description' => 'Area id.',
52 'component' => [
53 'type' => PARAM_COMPONENT,
54 'description' => 'Component the area is related to.',
56 'itemtype' => [
57 'type' => PARAM_ALPHANUMEXT,
58 'description' => 'Type of item in the component.',
60 'enabled' => [
61 'type' => PARAM_BOOL,
62 'description' => 'Whether this area is enabled.',
63 'default' => true,
65 'tagcollid' => [
66 'type' => PARAM_INT,
67 'description' => 'The tag collection this are belongs to.',
69 'callback' => [
70 'type' => PARAM_RAW,
71 'description' => 'Component callback for processing tags.',
72 'null' => NULL_ALLOWED,
74 'callbackfile' => [
75 'type' => PARAM_RAW,
76 'description' => 'Component callback file.',
77 'null' => NULL_ALLOWED,
79 'showstandard' => [
80 'type' => PARAM_INT,
81 'description' => 'Return whether to display only standard, only non-standard or both tags.',
82 'default' => 0,
84 'multiplecontexts' => [
85 'type' => PARAM_BOOL,
86 'description' => 'Whether the tag area allows tag instances to be created in multiple contexts. ',
87 'default' => false,
92 protected static function define_related() {
93 return array(
94 'locked' => 'bool?'
98 protected static function define_other_properties() {
99 return array(
100 'locked' => [
101 'type' => PARAM_BOOL,
102 'description' => 'Whether the area is locked.',
103 'null' => NULL_ALLOWED,
104 'default' => false,
105 'optional' => true,
110 protected function get_other_values(renderer_base $output) {
112 $values['locked'] = $this->related['locked'] ? true : false;
114 return $values;