Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 19... Línea 19...
19
use context;
19
use context;
20
use editor_tiny\plugin;
20
use editor_tiny\plugin;
21
use editor_tiny\plugin_with_buttons;
21
use editor_tiny\plugin_with_buttons;
22
use editor_tiny\plugin_with_menuitems;
22
use editor_tiny\plugin_with_menuitems;
23
use editor_tiny\plugin_with_configuration;
23
use editor_tiny\plugin_with_configuration;
-
 
24
use editor_tiny\plugin_with_configuration_for_external;
Línea 24... Línea 25...
24
 
25
 
25
/**
26
/**
26
 * Tiny H5P plugin for Moodle.
27
 * Tiny H5P plugin for Moodle.
27
 *
28
 *
Línea 30... Línea 31...
30
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 */
32
 */
32
class plugininfo extends plugin implements
33
class plugininfo extends plugin implements
33
    plugin_with_buttons,
34
    plugin_with_buttons,
34
    plugin_with_menuitems,
35
    plugin_with_menuitems,
35
    plugin_with_configuration {
36
    plugin_with_configuration,
36
 
-
 
37
    public static function is_enabled(
37
    plugin_with_configuration_for_external {
38
        context $context,
-
 
39
        array $options,
-
 
40
        array $fpoptions,
-
 
41
        ?\editor_tiny\editor $editor = null
-
 
42
    ): bool {
-
 
43
        // Users must have permission to embed content.
-
 
44
        return has_capability('tiny/h5p:addembed', $context);
-
 
45
    }
-
 
Línea 46... Línea 38...
46
 
38
 
47
    public static function get_available_buttons(): array {
39
    public static function get_available_buttons(): array {
48
        return [
40
        return [
49
            'tiny_h5p/h5p',
41
            'tiny_h5p/h5p',
Línea 71... Línea 63...
71
        return [
63
        return [
72
            'permissions' => $permissions,
64
            'permissions' => $permissions,
73
            'storeinrepo' => true,
65
            'storeinrepo' => true,
74
        ];
66
        ];
75
    }
67
    }
-
 
68
 
-
 
69
    #[\Override]
-
 
70
    public static function get_plugin_configuration_for_external(context $context): array {
-
 
71
        $settings = self::get_plugin_configuration_for_context($context, [], []);
-
 
72
        return [
-
 
73
            'embedallowed' => $settings['permissions']['embed'] ? '1' : '0',
-
 
74
            'uploadallowed' => $settings['permissions']['upload'] ? '1' : '0',
-
 
75
        ];
-
 
76
    }
76
}
77
}