Proyectos de Subversion Moodle

Rev

| 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
namespace core_courseformat\hook;
18
 
19
use core\hook\described_hook;
20
use cm_info;
21
 
22
/**
23
 * Hook for course-module name edited.
24
 *
25
 * @package    core_courseformat
26
 * @copyright  2024 Ferran Recio <ferran@moodle.com>
27
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 */
29
class after_cm_name_edited implements described_hook {
30
    /**
31
     * Constructor.
32
     *
33
     * @param cm_info $cm the course module
34
     * @param string $newname the new name
35
     */
36
    public function __construct(
37
        /** @var cm_info the course module */
38
        protected cm_info $cm,
39
        /** @var string the new name */
40
        protected string $newname,
41
    ) {
42
    }
43
 
44
 
45
    /**
46
     * Describes the hook purpose.
47
     *
48
     * @return string
49
     */
50
    public static function get_hook_description(): string {
51
        return 'This hook is triggered when a course module name is edited.';
52
    }
53
 
54
    /**
55
     * List of tags that describe this hook.
56
     *
57
     * @return string[]
58
     */
59
    public static function get_hook_tags(): array {
60
        return ['cm_name_edited'];
61
    }
62
 
63
    /**
64
     * Get course module instance.
65
     *
66
     * @return cm_info
67
     */
68
    public function get_cm(): cm_info {
69
        return $this->cm;
70
    }
71
 
72
    /**
73
     * Get new name.
74
     * @return string
75
     */
76
    public function get_newname(): string {
77
        return $this->newname;
78
    }
79
}