Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 * Tiny Link plugin.
19
 *
20
 * @package    tiny_link
21
 * @copyright  2022 Huong Nguyen <huongnv13@gmail.com>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
namespace tiny_link;
26
 
27
use context;
28
use editor_tiny\editor;
29
use editor_tiny\plugin;
30
use editor_tiny\plugin_with_buttons;
31
use editor_tiny\plugin_with_configuration;
32
use editor_tiny\plugin_with_menuitems;
33
 
34
/**
35
 * Tiny link plugin.
36
 *
37
 * @package    tiny_link
38
 * @copyright  2023 Huong Nguyen <huongnv13@gmail.com>
39
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40
 */
41
class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menuitems, plugin_with_configuration {
42
 
43
    /**
44
     * Get a list of the buttons provided by this plugin.
45
     *
46
     * @return string[]
47
     */
48
    public static function get_available_buttons(): array {
49
        return [
50
            'tiny_link/tiny_link_link',
51
            'tiny_link/tiny_link_unlink',
52
        ];
53
    }
54
 
55
    /**
56
     * Get a list of the menu items provided by this plugin.
57
     *
58
     * @return string[]
59
     */
60
    public static function get_available_menuitems(): array {
61
        return [
62
            'tiny_link/tiny_link_link',
63
        ];
64
    }
65
 
66
    /**
67
     * Get a list of the menu items provided by this plugin.
68
     *
69
     * @param context $context The context that the editor is used within
70
     * @param array $options The options passed in when requesting the editor
71
     * @param array $fpoptions The filepicker options passed in when requesting the editor
72
     * @param editor $editor The editor instance in which the plugin is initialised
73
     * @return array
74
     */
75
    public static function get_plugin_configuration_for_context(
76
        context $context,
77
        array $options,
78
        array $fpoptions,
79
        ?editor $editor = null
80
    ): array {
81
        // TODO Fetch the actual permissions.
82
        $permissions['filepicker'] = true;
83
 
84
        return [
85
            'permissions' => $permissions,
86
        ];
87
    }
88
}