-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtrema_admin_settings_styleguide.php
66 lines (61 loc) · 2.27 KB
/
trema_admin_settings_styleguide.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Style guide
*
* @package theme_trema
* @copyright 2019 Trema - {@link https://trema.tech/}
* @author Rodrigo Mady
* @author Trevor Furtado
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Class trema_admin_settings_styleguide
*
* @package theme_trema
* @copyright 2019 Trema - {@link https://trema.tech/}
* @author Rodrigo Mady
* @author Trevor Furtado
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class trema_admin_settings_styleguide extends admin_setting_heading {
/**
* not a setting, just text
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting'
* for ones in config_plugins.
* @param string $heading heading
* @param string $description text in box
*/
public function __construct($name, $heading, $description = '') {
$this->nosave = true;
parent::__construct($name, $heading, $description, '');
}
/**
* Returns an HTML string
*
* @param mixed $data array or string depending on setting
* @param string $query
* @return string
*/
public function output_html($data, $query = '') {
global $OUTPUT;
$context = new stdClass();
$context->title = $this->visiblename;
$context->description = (!empty($this->description));
$context->descriptionformatted = highlight($query, markdown_to_html($this->description));
return $OUTPUT->render_from_template('theme_trema/admin_setting_styleguide', $context);
}
}